11-29-2009, 05:29 PM
|
#1
|
|
|
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
|
|
|
11-29-2009, 06:07 PM
|
#2
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
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
|
|
|
11-29-2009, 06:30 PM
|
#3
|
|
|
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
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.
|
|
|
|
11-29-2009, 06:35 PM
|
#4
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
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..
|
|
|
11-29-2009, 06:50 PM
|
#5
|
|
|
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
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..
|
|
|
11-29-2009, 07:08 PM
|
#6
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
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
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
|
|
|
11-29-2009, 07:13 PM
|
#7
|
|
|
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
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";
|
|
|
|
11-29-2009, 07:18 PM
|
#9
|

 |
Halley Research Station,
Latitude 75°35' S,
Longitude 26°39' W,
Brunt Ice Shelf,
Coats Land,
Antarctica |
|
 |
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
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:12 PM.
|
|