Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > Projectors and CDs

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-29-2002, 11:13 PM   #1
Andy.burnett
Registered User
 
Join Date: Mar 2002
Location: UK
Posts: 19
Default Passing parameters at run time

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?
Andy.burnett is offline   Reply With Quote
Old 03-29-2002, 11:44 PM   #2
JHallam
Dosed...By Flash!
 
Join Date: Feb 2001
Location: England - Nottm
Posts: 1,192
Send a message via Yahoo to JHallam
Default

I don't think Flash 5 can, but I'm pretty sure MX maybe able to pass varibles. Depending on which type.



Quote:
To add parameters to the component, you will use the Component Definition dialog box. When you create a parameter, you give it a name, indicate the variable it is associated with, assign it a value, and specify a type. You will create three parameters: label, for the label text of the button, Label Font, for the font used in the label text, and Label Color, for the fill color of the label text.
....Says Macromedia
// http://......Link
Hope this helps
JHallam is offline   Reply With Quote
Old 03-30-2002, 09:18 AM   #3
Andy.burnett
Registered User
 
Join Date: Mar 2002
Location: UK
Posts: 19
Default Thanks, I will try that in MX.

And if not, I will have to add it to the Flash wishlist.
Andy.burnett is offline   Reply With Quote
Old 04-29-2002, 05:51 PM   #4
muffl3r
Registered User
 
Join Date: Apr 2002
Posts: 2
Wink This seems to work for me

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.
muffl3r is offline   Reply With Quote
Old 04-29-2002, 05:58 PM   #5
muffl3r
Registered User
 
Join Date: Apr 2002
Posts: 2
Wink This seems to work for me

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.
muffl3r is offline   Reply With Quote
Old 04-29-2002, 06:38 PM   #6
Andy.burnett
Registered User
 
Join Date: Mar 2002
Location: UK
Posts: 19
Smile Brilliant

Thanks very much for that. I think that is a great fix
Andy.burnett is offline   Reply With Quote
Old 12-23-2002, 10:55 PM   #7
tinnesda
Registered User
 
Join Date: Dec 2002
Location: US
Posts: 6
Default

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
tinnesda is offline   Reply With Quote
Old 08-08-2005, 07:26 PM   #8
Archangel7
Registered User
 
Join Date: Aug 2005
Posts: 4
Default

one little question... and If I have to pass a really really big sting?
Archangel7 is offline   Reply With Quote
Old 08-23-2005, 05:34 AM   #9
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
Default

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...
CyanBlue is offline   Reply With Quote
Old 09-09-2005, 06:29 AM   #10
shivraaz
Registered User
 
Join Date: Sep 2005
Posts: 1
Default

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.
shivraaz is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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


All times are GMT. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.