This content has been marked as final. Show 11 replies
> I think my problem is that Flash is trying to call movie
> clip methods on a string instance.
> I'm not sure how to type cast in Flash, or even if it is
> possible, but how would I access the strings as movie
Use eval() or the array access operator, . Details here ...
stiller (at) quip (dot) net
Dev essays: http://www.quip.net/blog/
"Luck is the residue of good design."
I've also tried this....
for(var i = 0; i < this.m_CardsDealt; i++)
//var holder:MovieClip = eval(cardArray );
var holder:MovieClip = this[cardArray];
_root.holder._x = 200;
//_root.cardArray ._x = 200;
holder._y = 250;
mImageLoader.loadClip("../Flash Project/Images/Cards/" + this.getDeck().getFile(), holder);
trace(_root.holder._x + " X VALUE OF MOVIE");
And also this....
cards.push(this["holeCard0" + this.m_CardsDealt++]);
My code keeps getting messed up when I transfer it to these boards, but after every place i use an array that needs an index, I have it . So where it sayssomething like cardArray._x, in my code it says cardArray [ i ]._x;
You need to decide whether you want holeCards or holdCards :-)
Is it BlackJack?
Also, please use code attachment, otherwise all your [array indices] go awry, and code becomes very difficult to read.
I fixed the typo, still no luck.
Can you repost please, with code attachment. I'll have a look.
Oops, sorry, I see you have already. Will be back in a few moments...
Ok, now I get at least one of the images to load to a movieClip (I see the image that I should see), but I still cannot modify the movie clip properties.
The following lines of code give me:
undefined X VALUE OF MOVIE
in my output panel.
I would not push string variables but direct references to the created movieClips, like so:
temp_mc = _root.createEmptyMovieClip....
rest unchanged (and I mean the original code, not the one with eval)
I tried the temp_mc = _root.createEmptyMovieClip.... method, but it doesn't seem to work. I don't even get the picture to load anymore.
Got it working fellas. Thanks for the help... It was all a matter of scope.. I added a definition of the scope as a member variable of my class, and it works like a charm. Thanks again guys.
Of course you can't set the properties in your changed variant, because it's an array of strings. So what good would the _x be for a string?
Your variant loads a clip, because the target parameter being a string is ignored. In the example with temp_mc it's an object, so it's not being ignored. You probably are loading the image, but don't see it, because something else is wrong.
Trace the return code on the mImageLoader.loadClip function call.
By the way, for me this line is dubious:
cards.push("holeCard0" + this.m_CardsDealt++); I know the ++ should increase the Number variable after being used, but you are constructing a string there. Did you ever trace your movieClip names? Maybe there's something wrong there.
I would definitely go with the temp_mc variant. In general, this works. I have used it successfully. But you need to update your depth counters, and CardsDealt, of course.