Animation gets stuck on rotation in Flash CS4
hi everybody.
here problem.
i have 1656x1332 px 30fps movie clip sliding or rotating on click event inside of 850x550 px stage. reason clip gets stuck on rotation sometimes, though whole file 46 kb. moreover, depending on browser, rotating part can fly off stage , way refresh. please me figure out what's going on here?
here code:
import fl.transitions.tween;
import fl.transitions.easing.*;
//animating transitions
function contentmover(contentxposition:number, contentyposition:number, contentrotation:number, loadsection:string):void{
var contxtween:tween = new tween(content, "x", regular.easeout, content.x, contentxposition, 1, true);
var contytween:tween = new tween(content, "y", regular.easeout, content.y, contentyposition, 1, true);
var controtationtween:tween = new tween(content, "rotation", regular.easeout, content.rotation, contentrotation, 1, true);
mainloader.source = loadsection;
}
//activating - disactivating navigation buttons
function buttonactivator(homebutton:boolean, aboutbutton:boolean, portfoliobutton:boolean, contactbutton:boolean):void{
content.home_btn.enabled = homebutton;
content.about_btn.enabled = aboutbutton;
content.portfolio_btn.enabled = portfoliobutton;
content.contact_btn.enabled = contactbutton;
}
//button opacity
function opacity(homebtn:number, aboutbtn:number, portbtn:number, contactbtn:number):void{
content.home_btn.alpha = homebtn;
content.about_btn.alpha = aboutbtn;
content.portfolio_btn.alpha = portbtn;
content.contact_btn.alpha = contactbtn;
}
buttonactivator(false, true, true, true);
//listening button click events
content.home_btn.addeventlistener(mouseevent.click, homeclick);
function homeclick(e:event):void {
contentmover(-666, -604, 0, null);
opacity(1,1,1,1);
buttonactivator(false, true, true, true);
}
content.about_btn.addeventlistener(mouseevent.click, aboutclick);
function aboutclick(e:event):void {
contentmover(-778, -410, 0, "about.swf");
opacity(1, .5,1,1);
buttonactivator(true, false, true, true);
}
content.portfolio_btn.addeventlistener(mouseevent.click, portfolioclick);
function portfolioclick(e:event):void {
contentmover(-526, -676, 0, "portfolio.swf");
opacity(1,1,.5,1);
buttonactivator(true, true, false, true);
}
content.contact_btn.addeventlistener(mouseevent.click, contactclick);
function contactclick(e:event):void {
contentmover(-672, 1380, -90, "contact.swf");
opacity(1,1,1,.5);
buttonactivator(true, true, true, false);
}
thanks!
try declaring tweens outside of function , see if helps.
var contxtween:tween;
var contytween:tween;
var controtationtween:tween;
you should place trace function calls inside @ start , end contentmover function can see if things follow expect them interms of going 1 condition another
function contentmover(contentxposition:number, contentyposition:number, contentrotation:number, loadsection:string):void{
contxtween = new tween(content, "x", regular.easeout, content.x, contentxposition, 1, true);
contytween = new tween(content, "y", regular.easeout, content.y, contentyposition, 1, true);
controtationtween = new tween(content, "rotation", regular.easeout, content.rotation, contentrotation, 1, true);
mainloader.source = loadsection;
}
More discussions in Adobe Animate CC - General
adobe
Comments
Post a Comment