07-23-2012, 12:39 PM
|
#1
|
|
Registered User
Join Date: Jul 2012
Posts: 11
|
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);
}
}
|
|
|
07-23-2012, 02:05 PM
|
#2
|
|
Senior Member
Join Date: Feb 2008
Location: West Palm Beach, FL
Posts: 3,776
|
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!
|
|
|
07-23-2012, 03:17 PM
|
#3
|
|
Registered User
Join Date: Jul 2012
Posts: 11
|
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?
|
|
|
07-23-2012, 08:36 PM
|
#4
|
|
Senior Member
Join Date: Oct 2009
Location: India
Posts: 124
|
why don't you try some tweening platform instead of AS3's built in ?
|
|
|
07-23-2012, 09:56 PM
|
#5
|
|
Senior Member
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 1,888
|
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.
|
|
|
07-24-2012, 01:34 PM
|
#6
|
|
Senior Member
Join Date: Mar 2009
Location: Sweden
Posts: 9,783
|
Actionscript doesn't have a tweening platform built in.
__________________
Signature: I wrote a pair of articles about the timeline.
|
|
|
07-24-2012, 01:41 PM
|
#7
|
|
Senior Member
Join Date: Feb 2008
Location: West Palm Beach, FL
Posts: 3,776
|
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.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 03:12 AM.
///
|
|