Go Back   kirupaForum > Flash > ActionScript 1.0/2.0

Reply
 
Thread Tools Display Modes
Old 11-29-2009, 05:29 PM   #1
mercuryfx
Registered User
trouble loading swf's from another folder

Here's the situation:

Start.swf has nothing in it but this AS in second frame: loadMovieNum("Resources/Game.swf", 0);

In the folder "Resources" are all my swf movies including "Game.swf", which opens fine from the AS above.

However, when clicking on a button in the Game.swf to open another swf, none of the other swfs open. All the other swfs are also in the Resources folder.

Here's the code for one of the buttons in the Game.swf:
on (release) {
loadMovieNum("Menu.swf", 0);
}

Interesting: If I open Game.swf by itself in the Resources folder, all the other swfs open fine. Again, they do not open if I start it using the Start.swf.

This game is going on a CD, not on web for now.

Question: What code do I need so when someone opens Start.swf, it opens Game.swf within the Resources folder and Game.swf buttons will then open the other swfs connected to it, which are also in the Resources folder?

Thanks
mercuryfx is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-29-2009, 06:07 PM   #2
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,158
The path to the folder is relative to the wrapper in which the SWF is embedded/launched and not the location of the SWF itself. That appears to be the problem here. You have a top-level folder (Top Folder) and a sub-folder (Resources). When you launch your application, Start.swf resides in the Top Folder. But then you replace Start.swf with Games.swf, so this is now playing in the Top Folder. All of your remaining swf's are still in the Resources folder so calling them with Menu.swf won't work as they're not located there. You have to continue to reference them from this Top Folder by using "Resources/Game.swf".
Alternatively, put a copy of Games.swf into that Top Folder.

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
glosrfc is offline   Reply With Quote
Old 11-29-2009, 06:30 PM   #3
mercuryfx
Registered User
Thanks for the advice but there has got to be a way to get into and stay in that Resources folder. Flash can't be that primitive.

This is going on a CD and I want only the "Start" application to be seen along with the Resources folder with my 40 other swfs.

Do you know exact code to use so that Start.swf opens Games.swf inside the Resources folder and allows all the other swfs in that Resources folder to open from the Games.swf?

Thanks!


Quote:
Originally Posted by glosrfc View Post
The path to the folder is relative to the wrapper in which the SWF is embedded/launched and not the location of the SWF itself. That appears to be the problem here. You have a top-level folder (Top Folder) and a sub-folder (Resources). When you launch your application, Start.swf resides in the Top Folder. But then you replace Start.swf with Games.swf, so this is now playing in the Top Folder. All of your remaining swf's are still in the Resources folder so calling them with Menu.swf won't work as they're not located there. You have to continue to reference them from this Top Folder by using "Resources/Game.swf".
Alternatively, put a copy of Games.swf into that Top Folder.
mercuryfx is offline   Reply With Quote
Old 11-29-2009, 06:35 PM   #4
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,158
I did say in my post...in your Games.swf change all of the URLs to the correct relative path from which they're going to be called, i.e. "Resources/xxxxx.swf"

Remember, although Games.swf is inside the Resources folder, it's actually going to be running from the Top Folder because that's where you've loaded it into Start.swf.

BTW, this isn't Flash being primitive. This is Flash being quite clever and protecting you, and the users, from potentially nasty files.

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells

Last edited by glosrfc; 11-29-2009 at 06:37 PM..
glosrfc is offline   Reply With Quote
Old 11-29-2009, 06:50 PM   #5
mercuryfx
Registered User
Thanks. But I think it's a little more complicated than that. I put the path as suggested in the Games.swf that now opens my Menu.swf, which is also in the Resources folder. Now, the Menu has 38 buttons. When one of these 38 buttons is clicked and the Play button is clicked, it's supposed to open a swf. Below is the code in the Play button.

Where in this code do I put the path you suggested so it opens whatever swf is called from within the Resources folder? Thanks.

on (release) {
for (i=1; i<=38; i++) {
if (_root["myBtn"+i].myState != 0) {
myMovieNum = _root["myBtn"+i].myCategory+i+".swf";
loadMovieNum(myMovieNum, 0);

}
}
}




Quote:
Originally Posted by glosrfc View Post
I did say in my post...in your Games.swf change all of the URLs to the correct relative path from which they're going to be called, i.e. "Resources/xxxxx.swf"

Remember, although Games.swf is inside the Resources folder, it's actually going to be running from the Top Folder because that's where you've loaded it into Start.swf.

BTW, this isn't Flash being primitive. This is Flash being quite clever and protecting you, and the users, from potentially nasty files.

Last edited by mercuryfx; 11-29-2009 at 06:55 PM..
mercuryfx is offline   Reply With Quote
Old 11-29-2009, 07:08 PM   #6
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,158
So you're not actually using this code at all? I guess I'm supposed to be clairvoyant!
Quote:
Originally Posted by mercuryfx View Post
Here's the code for one of the buttons in the Game.swf:
on (release) {
loadMovieNum("Menu.swf", 0);
}
You will have to prefix the folder path to your myMovieNum variable in the same way that you've appended the swf extension. Something like:
ActionScript Code:
myMovieNum = "Resources/" + _root["myBtn" + i].myCategory + i + ".swf";

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
glosrfc is offline   Reply With Quote
Old 11-29-2009, 07:13 PM   #7
mercuryfx
Registered User
I thought you were clairvoyant... sorry... Really, I thought it was a simple thing at first... Ok, I'll try this... Thanks!

Quote:
Originally Posted by glosrfc View Post
So you're not actually using this code at all? I guess I'm supposed to be clairvoyant!

You will have to prefix the folder path to your myMovieNum variable in the same way that you've appended the swf extension. Something like:
ActionScript Code:
myMovieNum = "Resources/" + _root["myBtn" + i].myCategory + i + ".swf";
mercuryfx is offline   Reply With Quote
Old 11-29-2009, 07:15 PM   #8
mercuryfx
Registered User
Your fix worked! You're a clairvoyant genius! Thanks!
mercuryfx is offline   Reply With Quote
Old 11-29-2009, 07:18 PM   #9
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,158
Usually I am clairvoyant...but it always helps to have the right code first, no matter how simple the problem might be.

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
glosrfc is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:12 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com