google addFrameScript() On Thu, Aug 6, 2009 at 11:19 AM, Isaac Alves <isaacal...@gmail.com> wrote:
> I would lke to know if I can manage the content of multiple frames without > having to create a script for each frame. > > project: > This is part of a type of "powerpoint style" presentation in flash. another > time I'll certainly try to do it by loading everything in the XML, and no > frame Nav. then the listener should not only tween the textfields and > movieclips, but also get the values of these objects by xml. > > a mouse click calls a function that fades out a textfield in a frame, go to > another frame and fades in the textfield that is in that frame. > > Code: > > function changeFrame(e):void > { > if (_txt){ > new GTween(_txt, 0.3 ,{alpha:0}); > } > var timer:Timer = new Timer(300, 1); > timer.addEventListener(TimerEvent.TIMER, function(){ > e.target.addEventListener(Event.ENTER_FRAME, updateFrame); > gotoAndStop(e.target.frameLink); > }); > timer.start(); > } > > function updateFrame(e:Event):void > { > > if (_txt){ > _txt.alpha =0; > new GTween(_txt, fadeDuration ,{alpha:1}); > > } > > e.target.removeEventListener(Event.ENTER_FRAME, updateFrame); > timer.reset(); > } > > problem: > when it changes frame, the actual movieclip or textfield will be there with > alpha 1. so it blinks, between the two alpha animations. > > conditions: > the fade should function with many movieclips, some of which won't exist in > every frame, that's why the verification ( if (!_txt)... ) But for the > moment I'm doing it like this. > > I surely don't want to write scripts in every frame, so that's the reason I > wrote the code like this. > > And anyway, I somehow feel that I shouldn't do it that way. What do you > people think about it ? > > Thanks in advance ! > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- --Joel Stransky stranskydesign.com _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders