PDA

View Full Version : sending .asp session variables to flash


pixedout
04-26-2006, 05:31 PM
Hi. If someone can help me with this... I will be temped to give you my first born child. This is day four of errors and Im losing my mind. I've looked at a few threads that seemed to relate to the topic of .asp session variables and sending them into flash... but Im still having trouble.

Here's the breakdown:
I want to send one session variable into flash from a dynamically generated .asp page. For example, gallery_sub.asp?c_id=10
And I want to be able to have that session variable be the id number that was genereated so I can tell where a user is in the site. The asp part works fine - since someone who knows what they're doing wrote it (i.e. pas moi).

Now, I am trying to get these variables by looping through and finding out which c_id the page is, but it's not working. Can anyone pointme in the right direction?

Here's the code:
____________________________

maxCategories =40;
_root.category = new LoadVars();
_root.category.onLoad = function(success) {
if(success){
_root.text = this.prefix;
}
}

for(CurrentCategory = 0; CurrentCategory <= maxCategories; CurrentCategory++){
//hardcoded url for testing only
//asp address for example: gallery_sub.asp?c_id=10
_root.category.load("http://66.36.28.230/alex/sjh/gallery_sub.asp?c_id="+ CurrentCategory);
trace(_root.category);
if (_root.category != "undefined"){
_root.text = _root.category;
}
}
//text box

stop();

Cota
04-26-2006, 06:12 PM
Could you be a little more clear than, its not working. Is the session ID being passed back? What exactly isnt working.

pixedout
04-26-2006, 06:19 PM
Thanks for looking at this.

By not working - I mean that the text box that I am using to test if the session variables are being passed in correctly always displays
"undefined".

Cota
04-26-2006, 06:33 PM
Give the text box name an instance name of "theText" then try using this
_root.theText.text = this.prefix;
Remember, "text" is a reserved word in Flash.

pixedout
04-26-2006, 09:57 PM
Thank you Cota for helping me work through this.
I wasn't paying attention to "text" being a flash word. Thanks for the heads up. However, even when I changed "text" to "testText" I'm still getting "undefined" in the text box.

Also, Im not sure if this sheds any light on things, but when I trace _root.category, I get "onLoad=%5Btype%20Function%5D" in the output box.
_________________ Current Code ________________

maxCategories =40;
_root.category = new LoadVars();
_root.category.onLoad = function(success) {
if(success){

_root.testText.text = this.prefix;
}
}

for(CurrentCategory = 0; CurrentCategory <= maxCategories; CurrentCategory++){
//hardcoded url for testing only
//asp address for example: gallery_sub.asp?c_id=10
_root.category.load("http://66.36.28.230/alex/sjh/gallery_sub.asp?c_id="+ CurrentCategory);
trace(_root.category);
if (_root.category != "undefined"){
_root.testText.text = _root.category;
}
}
//text box

stop();

pixedout
04-27-2006, 08:08 PM
Can anyone out there help me with the above post?
I didn't think it would be good ediquette to create a new post, but it would really help me if someone could take a look at this or shoot me some ideas.


Thanks

Cota
04-27-2006, 08:43 PM
Few things. These
trace(_root.category);
if (_root.category != "undefined"){
_root.testText.text = _root.category;
will always come back as undefined unless you put them in the onLoad for the LoadVars(). Put them there and see what happens.

pixedout
05-07-2006, 03:44 PM
Ok, for anyone who was interested.... or just to keep a nice tidy post, this is how I solved the problem of getting my dynamic .asp url into flash. Maybe someday this will help someone the way people on this forum have helped me.

It seems kind of bass-ackwards I know, but bear with me.

First, I used sessions variables in the html to send an embedded variable to flash. I didn't want to do this in Javascript, so here's how I did it:

In the hmtl before the <head></head> I created a sessions variable:

<%
Session("category") = Request.QueryString("c_id").Item;
%>


Then when I was constructing my flash object, I did this:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="120" height="300">
<param name="movie" value="flash/navigation.swf">
<param name=FlashVars value="id=<%=Session("category")%>">
<param name="quality" value="high">
<embed src="flash/navigation.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="120" height="300" FlashVars="id=<%=Session("category")%>"></embed>
</object>

And in the flash I just referenced this variable as _root.id. No postVars, flashVars, etc. Just used it right away.

Hope this helps. It's kind of a strange thing to do, but it took care of my problems and maybe next time I'll think it through a little better. Thanks Coda for your help.

Cheers!

g.bhaga
03-28-2008, 03:17 PM
Hi Pixedout

I also have the same problem.

can you tell me brief about what you are used in the flash action script code.

or please attach me the flash file