| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Mar 2002
Location: UK
Posts: 19
|
I want to pass parameters at the startup of a movie. In languages like C I would put arguments on the command line. Is there a similar way of doing this with Flash. For instance, is that some way of defining extra Object <PARAMETER NAME=...> tags which I could set in the HTML page, and that I can then access in the value of in movie?
|
|
|
|
|
|
#2 | |
|
Dosed...By Flash!
|
I don't think Flash 5 can, but I'm pretty sure MX maybe able to pass varibles. Depending on which type.
Quote:
|
|
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Mar 2002
Location: UK
Posts: 19
|
And if not, I will have to add it to the Flash wishlist.
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Apr 2002
Posts: 2
|
One way you can get around not being able to pass a parameter in is to add a "querystring" to your swf src in the embed tag / param movie in your object tag and then look at the _url property for the movie and strip off the query part. By this I mean:
Your html is like this <object ...> <param name=movie value="Flash/test.swf?x=123"> <embed src="Flash/test.swf?x=123"...></embed> </object> and then in your flash file you can look up this._url which will return your full path including the movie name and the "querystring". You then use string manipulation to get the parameter value out e.g. myURL = this._url; myPos = myURL.lastIndexOf("?"); myParam = myURL.substring(myPos,myURL.length - 1); //this returns the querystring elements - you can now split these using split Hope this helps - it should work in Flash 4 but definitely works in 5 from my tests so far. |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Apr 2002
Posts: 2
|
One way you can get around not being able to pass a parameter in is to add a "querystring" to your swf src in the embed tag / param movie in your object tag and then look at the _url property for the movie and strip off the query part. By this I mean:
Your html is like this <object ...> <param name=movie value="Flash/test.swf?x=123"> <embed src="Flash/test.swf?x=123"...></embed> </object> and then in your flash file you can look up this._url which will return your full path including the movie name and the "querystring". You then use string manipulation to get the parameter value out e.g. myURL = this._url; myPos = myURL.lastIndexOf("?"); myParam = myURL.substring(myPos,myURL.length); //this returns the querystring elements - you can now split these using split Hope this helps - it should work in Flash 4 but definitely works in 5 from my tests so far. |
|
|
|
|
|
#6 |
|
Registered User
Join Date: Mar 2002
Location: UK
Posts: 19
|
Thanks very much for that. I think that is a great fix
|
|
|
|
|
|
#7 |
|
Registered User
Join Date: Dec 2002
Location: US
Posts: 6
|
What if you wanted to pass some parameters into an .exe like ice projector or generator. Does anyone have any suggestions for this? Can it be done?
Thanks Much -Dave |
|
|
|
|
|
#8 |
|
Registered User
Join Date: Aug 2005
Posts: 4
|
one little question... and If I have to pass a really really big sting?
|
|
|
|
|
|
#9 |
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
|
I am not remembering what the actual limit was but it was something like 1024 or something similar... So, if you have bigger string than that, you've got to find another way of passing the variables such as using the server side script with LoadVars() object, for example...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...
|
|
|
|
|
|
#10 |
|
Registered User
Join Date: Sep 2005
Posts: 1
|
To get parameter values passed using queryString, we can directly use _root.<<parameter name>>.
For Ex: <param name=movie value="Flash/test.swf?x=123"> In your actionscript you can directly get its values using _root.x; other way would be, "FLASHVAR". Using this we can directly attach additional parameters. Checkout macromedia help to get more about parameters. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing Parameters to Functions | TheBarron | ActionScript 1.0 (and below) | 15 | 06-28-2002 05:43 PM |
| Passing parameters to functions? | jamessmb | ActionScript 1.0 (and below) | 3 | 06-28-2002 04:31 PM |
| flash run time engine | Taldos | ActionScript 1.0 (and below) | 0 | 03-30-2002 06:01 PM |
| Javascript to Flash - passing parameters - help! | Parker | Other Flash General Questions | 7 | 02-21-2002 09:55 AM |
| Time out on slow CPU | cain | ActionScript 1.0 (and below) | 2 | 08-11-2001 04:37 AM |