Dynamic text field content lost after first play

Posted by Odo 
Dynamic text field content lost after first play
July 20, 2009 11:07PM
I’m experimenting with CS4/AS3 with FlashEff 2.0 free version, and first – what a power toy :)
Now, I managed to make everything work as I wanted but one weird glitch remains and I can't overcome it. It’s probably due to architectural structure of my application. I’ll try to explain:
I have main.swf, part.swf and clsPrt.as class, idea is that main.swf creates clsPrt class which deals with loading of the different movie parts and playing them. part.swf is the actual simple movieclip that contains FlashEff and one dynamic text field. After clsPrt initializes part.swf is loaded into array of movieClips (well currently only one item in array but idea is to have number of clips in array and then start them one after another by listening FLASHEFFEvents.TRANSITION_END. So class loads part.swf and after loaded sets dynamic text field (myMC.myText.htmlText = ‘blabla’) and pushes myMC into array of clips (arrMCParts.push (myMC). Now all this sits in array and I start the part (addChild(arrMCParts[curId]). All works, clip plays, events fire, nice. Now to the problem.
When effects finish (text scrolls on, stays, then off), I’d like to make another go (if only part) or start another one from array. But now when effect starts, it gets populated with the dynamic text fields initial text (that was filled when designing part.swf) and not text set by AS after loading. Weird thing is that when I trace arrMCParts[curId].myText.htmlText before play, then it outputs my ‘blabla’ but effect is still running with default design-time preset text. Same goes for situation when I have 2 items in array populated with part.swf (physically same clip, but different instances in array) – first one plays nicely, second one ignores my dynamic text setting.
Any ideas what could be wrong here?
Re: Dynamic text field content lost after first play
July 23, 2009 12:41PM
Let me get this straight, you have a text field in which you feed text dynamically and when you try to change on text to another it keeps showing you the original text, right?
If this is what you are saying, it's probably because you are using a pattern that takes a snapshot(bitmapdata) of your text before it starts animating.
What you can do in this situation is to remove the effect using componentinstanceName.removeEffect(), feed the text, apply the animation again.
Let me know if it works.
Re: Dynamic text field content lost after first play
July 23, 2009 09:53PM
Ionut, yes, text field, filled dynamically. I've played around with it some more now and must admit that removeEffect did not help me, but apparently show() did. I rearranged things a bit and doing show() manually now in script and so far so good :)
But there are still some weird stuff happening…for example I have 3 clips now loaded and stored in array and starting them using script - whenever one stops the other starts and everything loops. Now after some looping I seem to loose reference to those very same dynamic text fields. Every clip loaded (and playing) traces the contents of text field before starting. After couple of loops I can’t do it as I get “null pointer error” i.e. myText. htmlText property is not available because myText is null…but at the same time effects work...thats the weird part ;) go figure, anyway it works like I need it to for now, perhaps one day I'll realize what was wrong…still warming up with flash and AC3 (and FlashEff ;)
Sorry, you do not have permission to post/reply in this forum.