-
really STRUGGLING passing variable from swfs (but javascript and xml is involved!!)
ok... i'm having some issues with my code. basically, i want to open a new window (pop_up.html) which contains a 2nd .swf, when you click on each of the thumbnails... but depending on which thumbnail you are on (thumbnail0,1,2,etc), i want to pass along the same variable (0,1,2,3,etc) into other swf which then takes the variable and loads a correlating image (based on an XML). i made a local connection in order to send/recieve data and everything works... but not consistently. this is where my confusion lies. it seems to work about 40% of the time. the rest of the time, the window opens, but the variable passed is "undefined" ...
i have a few speculations as to why this does not consistently work, but so far none have seemed to fix it. i am looking to launch tomorrow, if anyone can offer any advice or point me in the right direction, it would be greatly appreciated!
please, if any of this doesn't make sense (i can't imagine that ever happening ) please ask!
thanks so much
here is part of the code:
//this is on the sender swf file
whichthumbnail=_root.thumbnails["thumbnail"+i];
whichthumbnail.onRelease=function(){
what=this.num
my_lc=new LocalConnection();
getURL("javascript:win('pop_up.html')");
//made enterframe b/c it would open the URL so quickly and not register the local connection commands.
_root.thumbnails["thumbnail"+what].onEnterFrame=function(){
my_lc.send("connection_name", "create", what)
//keep checking to see if lc makes a connection. if so, delete enter frame
my_lc.onStatus=function(infoObject){
if (infoObject.level=="status"){
trace("you are connected");
delete _root.thumbnails["thumbnail"+what].onEnterFrame;
}
}
//this is the code for the receiver
var xmldoc = new XML()
xmldoc.ignoreWhite=true;
xmldoc.load("popups.xml");
xmldoc.onLoad=function(success){
if(success){
my_lc= new LocalConnection();
my_lc.connect("connection_name");
my_lc.create=function(avalue){
theimage=xmldoc.firstChild.childNodes[a].childNodes[0].firstChild
thecontainer=_root.container_mc.box
thecontainer.loadMovie(theimage)
}
my_lc.create(avalue)
}
}
-
Not sure what's happening, but have you tried checking if the variable "what" is set properly before sending it? Try a trace on it just in case the sender .swf isn't sending "undefined".
-
yes, i had a trace on there, i just took it out to make it more simple on here. it does trace correctly. like i said, it works once in a while and shows the image, but not consistently. i'm at a loss. i'm not one to usually ask for help, but i can't seem to figure this one out
thanks for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|