FORUMS: list search recent posts

home button and side button wont work afte second request

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
eamon white
home button and side button wont work afte second request
on May 9, 2012 at 7:33:07 am

everything works and but home breaks when i click on tween button... could it but my swfs are too big
could supply so i could email you my swfs and you could take a look?


import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.Event;
import com.greensock.*;
import com.greensock.easing.*;



var firstRequest:URLRequest = new URLRequest("home.swf");
var secondRequest:URLRequest = new URLRequest("move2.swf");
var thirdRequest:URLRequest = new URLRequest("tween.swf");
var fourthRequest:URLRequest = new URLRequest("parallax.swf");
var fifthRequest:URLRequest = new URLRequest("color.swf");

var swfLoader1:Loader=new Loader();

swfLoader1.load(firstRequest);
addChild(swfLoader1);

nava_mc.buttons_btn.addEventListener(MouseEvent.CLICK, buttonClick);
nava_mc.color_btn.addEventListener(MouseEvent.CLICK, colorClick);
nava_mc.movie_btn.addEventListener(MouseEvent.CLICK, movieClick);
nava_mc.tween_btn.addEventListener(MouseEvent.CLICK, tweenClick);
nava_mc.video_btn.addEventListener(MouseEvent.CLICK, videoClick);
nava_mc.parallax_btn.addEventListener(MouseEvent.CLICK, paraClick);
nava_mc.cell_btn.addEventListener(MouseEvent.CLICK, cellClick);
nava_mc.home_btn.addEventListener(MouseEvent.CLICK, homeClick);

nava_mc.mouseEnabled =false;




function buttonClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-838, ease:Strong.easeOut});

}


function colorClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-837, ease:Strong.easeOut,onComplete:onFinishTween});
function onFinishTween():void {
swfLoader1.unloadAndStop();
swfLoader1.load(fifthRequest);
}
}


function movieClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-837, ease:Strong.easeOut,onComplete:onFinishTween});
function onFinishTween():void {
swfLoader1.unloadAndStop();
swfLoader1.load(secondRequest);
}
}


function tweenClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-837, ease:Strong.easeOut,onComplete:onFinishTween});
function onFinishTween():void {
swfLoader1.unloadAndStop();
swfLoader1.load(thirdRequest);
}
}


function videoClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-837, ease:Strong.easeOut});
}

function paraClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-837, ease:Strong.easeOut,onComplete:onFinishTween});
function onFinishTween():void {
swfLoader1.unloadAndStop();
swfLoader1.load(fourthRequest);

}
}

function cellClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:-837, ease:Strong.easeOut});
}
function homeClick(e:MouseEvent):void{
TweenLite.to(nava_mc, 1, {x:58, ease:Strong.easeOut});
swfLoader1.unloadAndStop();
}


Return to posts index

eamon white
Re: home button and side button wont work afte second request
on May 9, 2012 at 7:47:29 am

4099_codeexample.zip


here is a link to the code

thanks


Return to posts index

demetri tashie
Re: home button and side button wont work afte second request
on May 9, 2012 at 1:11:58 pm

if you save the file down ( 5 or below ) , i'll take a look at it


Return to posts index


eamon white
Re: home button and side button wont work afte second request
on May 9, 2012 at 4:43:49 pm

4102_codeexample2.zip

here is the link


Return to posts index

demetri tashie
Re: home button and side button wont work afte second request
on May 9, 2012 at 5:00:54 pm

your project tries to load 'home.swf' which is not present


Return to posts index

demetri tashie
Re: home button and side button wont work afte second request
on May 9, 2012 at 7:48:26 pm

eamon,

by side button i hope you mean only the 'home' button, because all the other side buttons are neither named nor scripted.

your code works exactly as it should. you do not have a coding problem ( other than having all those redundant functions as they can all be consolidated into one function).

i am sure that it is a 'problem' in your 'tween.fla'. there is something in that file, that is not in the 'move2.fla', that is covering, or interfereing with the 'home' button. you can prove this for yourself by placing a movieclip BEHIND the 'nava_mc', name it 'loaderClip' ( or something else), and then have the 'swfLoader1' Loader be added as a child to that.

do that, and then just change this line of code:
addChild(swfLoader1);
to this:
loaderClip.addChild(swfLoader1);
and i am sure everything will then work as expected.

here are the files reworked, with a small dummy swf named 'home.swf' included

4105_codeexample1.zip


Return to posts index


eamon white
Re: home button and side button wont work afte second request
on May 11, 2012 at 5:21:04 am

thank for the help!
so i have giving an instance name and scripted the sidebuttons

for example

nava_mc.tween2_btn.addEventListener(MouseEvent.CLICK, teenClick);

funtion teenClick(e:MouseEvent):void{
swfLoader1.unloadAndStop();
swfLoader1.load(thirdRequest);
}

and the button will not work, I have but all the button in the just the nava_mc. I perivously had then in a sidenava_mc but took them out of that mc and put the directly into the nava_mc ( the code) what i am doing wrong?


Return to posts index

demetri tashie
Re: home button and side button wont work afte second request
on May 11, 2012 at 2:52:07 pm

if you did what you said, it should work perfectly.
make sure you spell the word function correctly in the code, though.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]