Posts

Showing posts from March, 2008

Actionscript 3.0 Tween Class Issue

Tween class in Actionscript 3.0 does not work the way it works in AS 2.0. In AS 2.0 we could create tween class variables inside a function and do a tween animation without worrying about garbage collection of the variable (declared using var) after the scope of the function is over. However this was not the case in Actionscript 3.0. Though it works, sometimes or rather most of the times the animation tends to halt in between or does not complete. This is a serious trouble since any TweenEvent.MOTION_FINISHED even does not get handled if any. The only solution to this problem was to define a Tween class member variable or a global static one. And if you try using the same static variable for more than one tween animation then you are still in soup. It is not guaranteed to work. In AS 3.0 you might have to overcome this using an array of variables of type Tween. This is the workaround to the problem. But since we have the garbage collector doing a timely sweep and clean we need not worr...

ActionSript 3.0 children and mouse issues

If you have a movie clip in the form of a button say a graphic in the background and a text in the foreground then in AS 3.0 you might find that myClip.buttonMode=true enables the button mode for the parent of the movieclip but not its children. I.e. on focussing the children or the text in our case the hand cursor turns to a mouse pointer. To handle this problem just set the mouseChildren property to false. myClip.mouseChildren = false;

ActionScript 3.0 TransitionManager

If TransitionManager.start(screen, {type:Fade, direction:Transition.IN, duration:trans_duration, easing:None.easeNone}); on a particular class extending movie clip fails or throws an exception while compiling or running then make the class dynamic as in public dynamic class Superb extends Movieclip.

ActionScript 3.0 - Varying Movieclip framerates

I needed a situation where a single movieclip could be played at different frame rates. Though action script 3.0 has this neat way of dynamically varying the frame rate of the entire stage using stage.frameRate I found it not suiting enough to my requirement. And hence tries using the updateAfterEvent instead. The only fear I had was with it working fine in the player but not so in firefox and IE. And to my surprise it seems ok. So to have your movieclip work at different framerates just do this. 1) Create a timer as shown below var lTimer:Timer=new Timer(200,0); lTimer.addEventListener(TimerEvent.TIMER,triggerUpdateClip) 2) Add a listener to this function triggerUpdateClip(event:TimerEvent) { myClip.nextFrame(); event.updateAfterEvent(); } Thats it. Now vary the delay of the timer to increase or decrease the speed of the animation. Make sure you test it in different browsers as they all worked and handle timers differently.

Flash Actionscript 3.0 MovieClips and GotoFrames and listeners

Doh! It was neat with Actionscript 2.0 but not so in 3.0. Again the same old dirty tricks. I had an issue with a particular movie clip containing two frames. A particular layer had a small close button movieclip available in frame 1 but not in frame 2. I.e. frame 2 had an empty key frame. When I initiate a gotoAndStop(2) from the AS file, the graphic does appears but the listeners just disappear. And in some occasions the graphic itself does not appear. AS 2.0 did not have such issues. I presume this is because of the reason that the whole chunk of information of a movie clip was preloaded. And hence everything remained in the memory. But in AS 3.0 graphics are loaded and initiated frame by frame. I came across an document from Adobe which said that listeners would be made available only if the objects in the frame the pointer moves to completely loads. And to do this we need to listen to the RENDER event. And then proceed with adding any listeners. Something like this... myButton.addE...

Masters in Interactive Technology

http://www.techlivez.com/2007/07/masters-degree-in-video-games-for-the-game-addicts/ Follow this link for a masters degree in interactive technology in Trinity College, Dublin