Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rating: Thread Rating: 47 votes, 4.57 average. Display Modes
Old 01-12-2006, 12:52 PM   #1
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Exclamation Passing Variable

Hey There All!

Okay - been working on a project FOREVER & Im almost to the point where it's going to work but I need some serious help....

This is what I have so far.... (the notes are from another forum - not trying to cross post, I was just in the wrong place before)

Code:
// then where ever you are setting your variables do:
sender.id=#url.id#;


// send the id value to your cfm page using sendAndLoad, and returned xml will be loaded into the xml object x.
sender.sendAndLoad("info1.cfm",x,"GET");
	
};
and
Code:
var x:XML=new XML();
x.ignoreWhite=true;x.onLoad=function(done){
	if(done){
		trace('xml file is now loaded into '+this);
		// now that it is loaded, process it the way you want.
};var sender:LoadVars=new LoadVars();
The problem ... you cant actually put #url.id# in actionscript - I need to identify the ID and then (so I've been told) it will be passed w/ the link to the cfm file as a url.id.

The question:
How do I make that sender.id dynamic based upon the url.id fed to the swf?

AKA

the url
somecoolsite.com?id=something_dynamic

the swf
gallery.swf?id=something_dynamic

the sender.id NEEDS TO BE
sender.id=something_dynamic;

so that the the files in the cfm page will be dynamically generated based upon that url.id & therefore the correct images will show.

*** yeah, I know I've put xml information in a cfm page - the .cfm is not messing up the xml or the flash... if I hard code the images into the .cfm page flash is fine w/ it... it's just passing the variable that's got me stumped.


thebutterfly is offline   Reply With Quote
Old 01-12-2006, 01:21 PM   #2
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Default

Also.. do I need to repalce X in my sendAndLoad to the variable for url.id?
thebutterfly is offline   Reply With Quote
Old 01-12-2006, 03:01 PM   #3
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Unhappy Found Example but not sure how to apply it

Hey All - sorry if it seems abnoxious that I keep posting to my own thing here but I'm really up a creak & being over my head w/ this doenst mean that I dont still need to find a way to get it done. I already tried hiring someone but what they gave me wont work - they did everything but pass the id.

Any help you can give would be great!


Okay - I found the following example but am not sure how to apply it to my code:


Quote:
Example
For the following example, add a TextInput instance called name_ti, a TextArea instance called result_ta, and a Button instance called submit_button to the Stage. When the user clicks the Login button instance in the following example, two LoadVars objects are created: send_lv and result_lv. The send_lv object copies the name from the name_ti instance and sends the data to greeting.cfm. The result from this script loads into the result_lv object, and the server response displays in the TextArea instance (result_ta). Add the following ActionScript to Frame 1 of the Timeline:

var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = result_lv.welcomeMessage;
} else {
result_ta.text = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.name = name_ti.text;
send_lv.sendAndLoad("http://www.flash-mx.com/mm/greeting.cfm", result_lv, "POST");
};
submit_button.addEventListener("click", submitListener);

To view a more robust example, see the login.fla file in the HelpExamples folder. Typical paths to the HelpExamples folder are:

Windows: \Program Files\Macromedia\Flash MX 2004\Samples\HelpExamples\
Macintosh: HD/Applications/Macromedia Flash MX 2004/Samples/HelpExamples/

LoadVars.send(), XML.sendAndLoad()

Code:
// then where ever you are setting your variables do:
sender.id=#url.id#;
// send the id value to your cfm page using sendAndLoad, and returned xml will be loaded into the xml object x.
sender.sendAndLoad("info1.cfm",x,"GET");
	
};


var x:XML=new XML();
x.ignoreWhite=true;x.onLoad=function(done){
	if(done){
		trace('xml file is now loaded into '+this);
		// now that it is loaded, process it the way you want.
};var sender:LoadVars=new LoadVars();



imageXML.load(_root.xmlFile);

_lockroot = true;
thanks!
thebutterfly is offline   Reply With Quote
Old 01-12-2006, 03:02 PM   #4
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Default

also found this:

http://www.intel.com/cd/ids/develope...0228.htm?prn=Y
thebutterfly is offline   Reply With Quote
Old 01-12-2006, 03:30 PM   #5
FrodoBaggins
Fellowship of the Script
 
Join Date: Jan 2006
Location: the Netherlands / heading to the UK
Posts: 629
Default

Quote:
the swf
gallery.swf?id=something_dynamic
I'm not sure I'm getting what you want to do?
Do you want to be able to call gallery.swf?id=123 and that you use the id to lookup a certain image?
FrodoBaggins is offline   Reply With Quote
Old 01-12-2006, 03:36 PM   #6
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Default

I am able to call gallery.swf?id=123

I am unable to get flash to send that id to the cfm file that lists the images

meaning I want someone to click a url and have that tell the flash which photos to show

sorry.. is this more clear?

also - just tried entering a number into the code for the id & that didnt work either... would it be easier if I were to post my whole action script?
thebutterfly is offline   Reply With Quote
Old 01-12-2006, 04:23 PM   #7
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Arrow

what about something like this - i mean I havent loaded the variable so it makes sence I cant send it so...

Code:
	_root.loadVariables(info1.cfm?id=#url.id#,this)
	
	//forum
	// then where ever you are setting your variables do:
sender.id=#url.id#;
// send the id value to your cfm page using sendAndLoad, and returned xml will be loaded into the xml object x.
sender.sendAndLoad("info1.cfm",x,"GET");

var x:XML=new XML();
x.ignoreWhite=true;x.onLoad=function(done){
	if(done){
		trace('xml file is now loaded into '+this);
		// now that it is loaded, process it the way you want.
};var sender:LoadVars=new LoadVars();

}

imageXML.load(_root.xmlFile);

_lockroot = true;
I know this still doesnt answer my dynamic variable question but I think it's a bit closer... anyone?
thebutterfly is offline   Reply With Quote
Old 01-12-2006, 04:42 PM   #8
FrodoBaggins
Fellowship of the Script
 
Join Date: Jan 2006
Location: the Netherlands / heading to the UK
Posts: 629
Default

For the loading part, have a look at this: http://www.actionscript.org/forums/s...php3?t=93758#6

And what does your "info1.cfm" do? What does it accept, 'cause I'm building an RSS reader atm. I send an XML string to a "xml_proxy.php" file, that strips the info out of the received XML string, sents a requests to the RSS server and returns an XML string back to flash.
FrodoBaggins is offline   Reply With Quote
Old 01-12-2006, 05:00 PM   #9
thebutterfly
Yup - Im lost...
 
Join Date: Dec 2005
Posts: 118
Send a message via ICQ to thebutterfly
Default

Hey There - looking at that post now - my question w/ that is how do I apply it here (w/ a dynamic id)? and ... well...

Images = new LoadVars();myData.load("info1.cfm?id=?????");
Images.onLoad = function(succes) {
if (succes) {
trace(this.images); }
};



As for info1.cfm - it's an xml file that loads the images into the flash movie however it has to have that colfusion query for #url.id# to fill in the links to the images.

Sorry if Im not being 100% clear - Im pretty new at this.
thebutterfly is offline   Reply With Quote
Old 01-12-2006, 05:05 PM   #10
FrodoBaggins
Fellowship of the Script
 
Join Date: Jan 2006
Location: the Netherlands / heading to the UK
Posts: 629
Default

Quote:
Originally Posted by thebutterfly
As for info1.cfm - it's an xml file that loads the images into the flash movie however it has to have that colfusion query for #url.id# to fill in the links to the images.
An XML file can't execute any code. So what is this thing?
FrodoBaggins 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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a Variable via URL to swf to HTML bmaniero HTML and JavaScript 2 07-19-2005 06:24 PM
Skinning components with embedded components epeace Components 5 06-16-2005 08:35 PM
Passing Variable from an HTML query string Zarko ActionScript 1.0 (and below) 3 03-18-2002 11:04 PM
Writing to a file (locally only) isleshocky77 ActionScript 1.0 (and below) 13 08-23-2001 02:43 AM


All times are GMT. The time now is 01:08 PM.

///
Follow actionscriptorg on Twitter

 


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