-
1. Re: Delay action of button to URL.
kglad Dec 20, 2010 1:09 PM (in response to ruthgordy)use:
// This is code that loads and plays above animation when you open swf/html file - code is on frames 1-25
stop();
gotoAndPlay(1);
function startMovie(event:MouseEvent):void
{
this.play();
}
teach_btn.addEventListener(MouseEvent.CLICK, startMovie);
// This is code that connects user to URL - this code is only on keyframe 26
stop();
mouseClick(null);function mouseClick(event:MouseEvent):void
{
var request = new URLRequest("http://www.webpage.com/")
navigateToURL(request,"_blank");
}
Thanks
-
2. Re: Delay action of button to URL.
ruthgordy Dec 20, 2010 1:56 PM (in response to kglad)Thanks kglad,
The coding does work now when viewer clicks on button, animation runs then goes to URL. That's just what I want.
Unfortunately when the swf/html OPENS initially and the above animation runs - it also goes to the URL - I don't want viewer to automatically go to URL unless they actively click on the button to activate the animation/go to URL.
Can we send swf/html files to forum participants? This may help you see what I'm trying to accomplish.
Here's where I'm at with your edits to my coding.
// This is code that loads and plays above animation when you open swf/html file - code is on frames 1-25
stop();
gotoAndPlay(1);
function startMovie(event:MouseEvent):void
{
this.play();
}
teach_btn.addEventListener(MouseEvent.CLICK, startMovie);
// This is code that connects user to URL - this code is only on keyframe 26
stop();
mouseClick(null);function mouseClick(event:MouseEvent):void
{
var request = new URLRequest("http://www.webpage.com/")
navigateToURL(request,"_blank");
}
-
3. Re: Delay action of button to URL.
kglad Dec 20, 2010 2:47 PM (in response to kglad)are those two code snippets on different timelines? i know they're in different frames but the question is, are they on different timelines?
-
4. Re: Delay action of button to URL.
ruthgordy Dec 20, 2010 3:46 PM (in response to kglad)I put the two separate snippets on different AS timelines and it is still going automatically to the URL?
-
5. Re: Delay action of button to URL.
kglad Dec 20, 2010 4:07 PM (in response to ruthgordy)the quickest (but not best) way to help you do this:
// This is code that loads and plays above animation when you open swf/html file - code is on frames 1-25
stop();
gotoAndPlay(1);
function clickF(event:MouseEvent):void
{
if(MovieClip(root).played){
var request = new URLRequest("http://www.webpage.com/")
navigateToURL(request,"_blank");
} else {
MovieClip(root).clicked=true;
}
}
teach_btn.addEventListener(MouseEvent.CLICK, clickF);
// This is code that connects user to URL - this code is only on keyframe 26
stop();
navToF();
function navToF():void
{
if(MovieClip(root).clicked){
var request = new URLRequest("http://www.webpage.com/")
navigateToURL(request,"_blank");
} else {
MovieClip(root).played=true;
}
}
-
6. Re: Delay action of button to URL.
ruthgordy Dec 21, 2010 8:00 AM (in response to kglad)thanks kglad,
this works great!! You're awesome!
-
7. Re: Delay action of button to URL.
kglad Dec 21, 2010 9:03 AM (in response to ruthgordy)you're welcome.



