Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sk3pt1c

macrumors 6502a
Original poster
Nov 29, 2005
918
6
a simulacrum
i have made a little intro movie to a website i'm creating for a client and i want it to redirect to the home page when it's done playing.
what function should i use in actionscript 3?
is it enterFrame ?
any help wood be appreciated, thanks
 
turns out you're right, but in Action Script 3 it's more like

var url:String = "home.html";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, '_blank');
} catch (e:Error) {
trace("Error occurred!");
}

_blank though opens the target in a new window, and _self doesn't seem to work for some odd reason...
any ideas?
 
another way to go about it would be to add a stop(); at the last frame of the flash movie and this to the html of the page:

<META HTTP-EQUIV="refresh" CONTENT="25;URL=redirect.html">

so you can redirect to the page you want after a certain time (here 25secs)

which works fine, but i'd rather have it all in the swf file because depending on people's connection speeds the flash file would take some time to load so it's not really certain that they'd see all of the animation within the time specified...

which leaves us with the same problem with ActionScript, how to open the new url in the same window :(

anyone?
 
right, turns out that:

var url:String = "home.html";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_self");
} catch (e:Error) {
trace("Error occurred!");
}

works just fine, it was just not working on my computer due to
security restrictions of the flash player...
now, i don't know if it will work for some people and not for others
but i'm guessing that since i can see it properly on the web so should others,
right?
 
Wow- I guess I will never be using actionscript 3. I can't believe they would make it that convoluted to do a getURL. Also, actionscript 3 won't let you use code from 1 and 2? Sounds fishy.

The security restriction is just because you are previewing locally. Dump it on a server and test it- it should be fine.
 
Wow- I guess I will never be using actionscript 3. I can't believe they would make it that convoluted to do a getURL. Also, actionscript 3 won't let you use code from 1 and 2? Sounds fishy.

The security restriction is just because you are previewing locally. Dump it on a server and test it- it should be fine.

If you write actionscript I would suggest starting to use version 3. It might seem more convoluted at first, but in many cases it actually makes coding easier. For very simple things it means that you may have to write more lines of code and if that is the case using version 2 is fine. For more complex projects though it makes it easier to write more efficient and cleaner code. At least that has been my experience. I was hesitant to use it at first because it was a pain to learn the new syntax, but it is definitely worth it for me since I have been writing a lot of actionscript lately.

The changes to version 3 make it compliant with the ECMA-262 standard which actionscript is based on. Also actionscript 3 code executes much faster than previous version because of the new virtual machine that runs it. The reason you can't use version 1 or 2 code is because the new virtual machine does not understand that code.
 
If you write actionscript I would suggest starting to use version 3. It might seem more convoluted at first, but in many cases it actually makes coding easier. For very simple things it means that you may have to write more lines of code and if that is the case using version 2 is fine. For more complex projects though it makes it easier to write more efficient and cleaner code. At least that has been my experience. I was hesitant to use it at first because it was a pain to learn the new syntax, but it is definitely worth it for me since I have been writing a lot of actionscript lately.

The changes to version 3 make it compliant with the ECMA-262 standard which actionscript is based on. Also actionscript 3 code executes much faster than previous version because of the new virtual machine that runs it. The reason you can't use version 1 or 2 code is because the new virtual machine does not understand that code.

Yeah, personally the value of re-learning this for the third time is just not there. I'm not sure how relevant flash really is anymore. The only things I still need it for are banner ads and video- neither of which use complex code.
 
Yeah, personally the value of re-learning this for the third time is just not there. I'm not sure how relevant flash really is anymore. The only things I still need it for are banner ads and video- neither of which use complex code.

I'm not sure flash is that relevant anymore either. Other than video/animations and audio, I have a hard time seeing a legitimate use for it, especially when you can achieve many of the same effects with javascript.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.