Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-23-2012, 12:39 PM   #1
gez
Registered User
 
Join Date: Jul 2012
Posts: 11
Default Browser Scrambling x,y,z movie clip coordinates

I'm loading an external swf into my Flash application, the external swf is an interface that is animated, controlled by tweens in AS3.

Testing the application within Flash reveals no issues, I can load/unload this external swf all day long with no bugs.

When previewing in a browser the initial load/unload of the external swf runs flawlessly, beyond this point loading/unloading the swf a second and any addition times causes the movie clip symbols to appear scattered.

The AS3 tweens (z,x,y axis, width, height & Alpha Channel) are clearly still executing however they do not follow the specified coordinates/values.

All tweens are global, to ensure they are not prematurely earased by the garbage collector!

here's a sample:
ActionScript Code:
stop(); import fl.transitions.Tween; import fl.transitions.TweenEvent; import fl.transitions.easing.*; scrollingThumbs_mc.mouseEnabled = false; videoScreen_mc.mouseEnabled = false; //Claim Tween's as Global Variables to avoid AS3 Garbage Collector var scrollThumbsX:Tween; var scrollThumbsY:Tween; var scrollThumbsZ:Tween; var scrollThumbsH:Tween; var scrollThumbsA:Tween; var infoPanelX:Tween; var infoPanelY:Tween; var infoPanelZ:Tween; var infoPanelW:Tween; var infoPanelH:Tween; var infoPanelA:Tween; var videoScreenX:Tween; var videoScreenY:Tween; var videoScreenZ:Tween; var videoScreenW:Tween; var videoScreenH:Tween; var videoScreenA:Tween; var nextGalBtnX:Tween; var nextGalBtnA:Tween; var prevGalBtnX:Tween; var prevGalBtnA:Tween; prevGalBtn_mc.visible = false; nextGalBtn_mc.visible = false; prevGalTitle_mc.visible = false; nextGalTitle_mc.visible = false; addEventListener(Event.ENTER_FRAME, animStartF); function animStartF(e:Event):void{     trace("Tweens Started");     removeEventListener(Event.ENTER_FRAME, animStartF);         ///Animate Scrolling Thumbnails     scrollThumbsX=new Tween (scrollingThumbs_mc,"x", Strong.easeOut,-536.8,-262.6,1,true);     scrollThumbsY=new Tween (scrollingThumbs_mc,"y", Strong.easeOut,-434.5,-548.2,1,true);     scrollThumbsZ=new Tween (scrollingThumbs_mc,"z", Strong.easeOut,80,0,1,true);     scrollThumbsH=new Tween (scrollingThumbs_mc,"height", Strong.easeOut,1631.40,2350.25,1,true);     scrollThumbsA=new Tween (scrollingThumbs_mc,"alpha", Strong.easeOut,0,1,1,true);         ///Animate Info Panel     infoPanelX=new Tween (infoPanel_mc,"x", Strong.easeOut,828.1,614.8,1,true);     infoPanelY=new Tween (infoPanel_mc,"y", Strong.easeOut,-4.3,20,1,true);     infoPanelZ=new Tween (infoPanel_mc,"z", Strong.easeOut,80,0,1,true);     infoPanelW=new Tween (infoPanel_mc,"width", Strong.easeOut,325.60,517.80,1,true);     infoPanelH=new Tween (infoPanel_mc,"height", Strong.easeOut,485.30,771.70,1,true);     infoPanelA=new Tween (infoPanel_mc,"alpha", Strong.easeOut,0,0.5,1,true);         ///Animate Video Screen     videoScreenX=new Tween (videoScreen_mc,"x", Strong.easeOut,-106.7,-350,1,true);     videoScreenY=new Tween (videoScreen_mc,"y", Strong.easeOut,-77.5,-250,1,true);     videoScreenZ=new Tween (videoScreen_mc,"z", Strong.easeOut,80,-80,1,true);     videoScreenW=new Tween (videoScreen_mc,"width", Strong.easeOut,215.95,701.8,1,true);     videoScreenH=new Tween (videoScreen_mc,"height", Strong.easeOut,153.95,501.80,1,true);     videoScreenA=new Tween (videoScreen_mc,"alpha", Strong.easeOut,0,1,1,true);         videoScreenA.addEventListener(TweenEvent.MOTION_FINISH, animNextPrevF);         function animNextPrevF(e:TweenEvent):void{         videoScreenA.removeEventListener(TweenEvent.MOTION_FINISH, animNextPrevF);         prevGalBtn_mc.visible = true;         nextGalBtn_mc.visible = true;         nextGalBtnX=new Tween (nextGalBtn_mc,"x", Strong.easeOut,42,927.5,2,true);         nextGalBtnA=new Tween (nextGalBtn_mc,"alpha", Strong.easeOut,0,1,0.5,true);         prevGalBtnX=new Tween (prevGalBtn_mc,"x", Strong.easeOut,-42,-668.1,2,true);         prevGalBtnA=new Tween (prevGalBtn_mc,"alpha", Strong.easeOut,0,1,0.5,true);     }         scrollThumbsA.addEventListener(TweenEvent.MOTION_FINISH, animGalF);     function animGalF(e:TweenEvent):void{         scrollThumbsA.removeEventListener(TweenEvent.MOTION_FINISH, animGalF);         trace("Going to Animation Gallery");                 //Once Animation Is Complete goto frame 2         scrollingThumbs_mc.mouseEnabled = true;         gotoAndStop(2);     } }
gez is offline   Reply With Quote
Old 07-23-2012, 02:05 PM   #2
lordofduct
Senior Member
 
lordofduct's Avatar
 
Join Date: Feb 2008
Location: West Palm Beach, FL
Posts: 3,872
Default

you just need references to the tweens... how bout just sticking them in an array?

also why do you listen for ENTER_FRAME, and on the first fire of that event stop listening for it? Is there some reason you're waiting for this moment? Are you trying to wait for when it's ADDED_TO_STAGE? Maybe try that event instead?

As for your browser issue... not sure, but you do a lot of janky things in your code... so remove the jankiness first, and unit test from there.
__________________
www.lordofduct.com - come read my blog!

If you want to know how to program, take a math class, take a lot of math classes!
lordofduct is offline   Reply With Quote
Old 07-23-2012, 03:17 PM   #3
gez
Registered User
 
Join Date: Jul 2012
Posts: 11
Default

oh! haha ok...I taught myself Action Script 3 so I guess I picked up a few bad habits from online tutorials.

I included the enter frame event after discovering the scrambling bug when testing my application in browsers and because I have other sections of the interface that initiate with a series of tweens/anaimation as well, I wanted to be certain these initial tweens were inactive once another frame was entered by removing the enter frame event listener containing the tweens.

How would I go about lessening the amount of jankiness in my code?
How would you reference these tweens?
gez is offline   Reply With Quote
Old 07-23-2012, 08:36 PM   #4
thawfeek_yahya
Senior Member
 
thawfeek_yahya's Avatar
 
Join Date: Oct 2009
Location: India
Posts: 129
Send a message via Yahoo to thawfeek_yahya Send a message via Skype™ to thawfeek_yahya
Default

why don't you try some tweening platform instead of AS3's built in ?
thawfeek_yahya is offline   Reply With Quote
Old 07-23-2012, 09:56 PM   #5
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,331
Default

You should look into TimelineMax for complex sequences of Tweens, or projects with numerous or complex tweens.

TweenMax allows you Tween multiple properties, including filter effects, in a single instance.
It can also tween multiple displayobjects in a single instance.
TimelineMax allows you to sequence multiple TweenMax instances.
[afz]snickelfitz is offline   Reply With Quote
Old 07-24-2012, 01:34 PM   #6
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,676
Send a message via Skype™ to henke37
Default

Actionscript doesn't have a tweening platform built in.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is online now   Reply With Quote
Old 07-24-2012, 01:41 PM   #7
lordofduct
Senior Member
 
lordofduct's Avatar
 
Join Date: Feb 2008
Location: West Palm Beach, FL
Posts: 3,872
Default

They meant the one included in the fl.* library. And you know that.

If you want to point out their mistake, how about at least giving them the information needed. That the fl library included with Flash CS# is not "built-in" to AS3, and it isn't assumed to be available when writing AS3 (such as if you write flex apps with out Flash CS#).
__________________
www.lordofduct.com - come read my blog!

If you want to know how to program, take a math class, take a lot of math classes!

Last edited by lordofduct; 07-24-2012 at 01:44 PM.
lordofduct is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:59 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.