-
Flash 8 passing vars
Hello,
First I want to say that I am not a flash/action script expert and my question could be stupid, but I cannot launch my site without solve this problem.
I have a flash movie that loads external swf in the window component using the function:
var my_win:MovieClip = mx.managers.PopUpManager.createPopUp(_root, Window, false, {title:caption, contentPath:contentpath, closeButton:true});
All is working well, but now I have a problem - I need to pass variables to the external movie (contentPath is the path to the swf). I googled fot the answer and I found this:
example.swf?var=alabala&var2=sometext
but this works only when I use it in HTML page. I found the documentation for FlashVar, but it works only in HTML page.
Can anyone help me with some solution, code, docs ...
Best regards!
-
1 Attachment(s)
Not sure if it'll work in the Popup Manager, but I tested it using "loadMovie()"
In the "child" movie i.e the popup, you should just be able to go ->
_parent.myVariableName
I've attached 2 .fla files which show it working through trace() in a movie loaded into the main movie. The same sort of thing should work in a popup I'm guessing.
Cheers,
Niggle
-
Yep, I do it :)
_global.var1;
_global.var2;
Ye, ye, I know - Sometimes the big problem have very simple solution :)
10x to niggles
Edit: Now I have another problem :(
The content of some movieclips is larger than the windows and I need to dynamically attach scrollbar to the window, but I only found how to attach scroll bar to text field.
Best regards!
-
Hello,
I have a problem ... again. I am opening the main swf in an ASP .NET page, but the child movies wont open. Everything is working well in flash only, but when I do it through my page. I changed the paths from absolute to relative, but it didn't work :(
-
Flash takes it's path from the HTML/ASP page it's embedded in - which can cause issues once on an actual server as opposed to a folder on your hard drive.
Not sure why the absolute links don't work - they should. Try using a full URL including the http:// and see if that fixes it.
What I do is set a variable for the path so I can test it locally and on the server-
pathToFiles = "/some-file-path/";
getURL(pathToFiles + "myMovie.swf");
-----
When testing on your hard-drive, set pathToFile = ""; so it doesn't append anything, when testing on the actual server, put in the whole address.
Hope this helps.
Cheers,
Nigel
-
Ok, I did it, but it's not working well. In the main movie I have declared some _global variables, but the movie that I am loading is not able to read them. But when I start it from Flash (Test movie) it's working ?!