PDA

View Full Version : Variable Help



ben_is_sparky
October 16th, 2005, 08:44 AM
I can't understand this... Can anyone explain it, or how to get around it?
I've got this on a movieclip:


onClipEvent(load){
thisName = this._name
thisPictureNumberArray = thisName.split("Container")
thisPictureNumber = thisPictureNumberArray[1]
//Picture Variables
thisPictureTitle = _parent.titlesArray[thisPictureNumber]
thisPictureDescription = _parent.descriptionsArray[thisPictureNumber]
thisPicturePath = _parent.pathsArray[thisPictureNumber]
//******************If I trace(thispictureTitle) here, it works
//Popup Window Variables
winURL = "popup_2.html";
winName = "Andrew Scott Photography";
winWidth = 830;
winHeight = 770;
winToolbar = 0;
winLocation = 0;
winDirectories = 0;
winStatus = 0;
winMenuBar = 0;
winScrollbars = 1;
winResizable = 0;
}

//If clicked...
on(release) {
//Send the Picture Info to the Popup
//Open Popup
getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + winURL + "','" + winName + "','" + "width=" + winWidth + ",height=" + winHeight + ",toolbar=" + winToolbar + ",location=" + winLocation + ",directories=" + winDirectories + ",status=" + winStatus + ",menubar=" + winMenuBar + ",scrollbars=" + winScrollbars + ",resizable=" + winResizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);");
//Check when the popup is opened.
sendPicturreInfo = new LocalConnection();
sendPicturreInfo.connectionOK = function(){
//******************If I trace(thispictureTitle) here, it doesn't work
sendPicturreInfo.send("pictureInfo", "getinfo", "Title", "This is the first test picture.", "pictures/tort1.jpg");
}
sendPicturreInfo.connect("connectionTest");
}

(see the bits about trace(thispictureTitle))

ben_is_sparky
October 16th, 2005, 10:09 AM
Do I need to add the variables as an argument or something, like you would with a function?

ben_is_sparky
October 17th, 2005, 12:28 PM
[sorrysorrysorry]

Nobody knows?

Barn
October 17th, 2005, 01:26 PM
Nobody knows?
The key is, nobody knows what you want. You asked how to "get around it" without explaining what you meant by "it" and what you expected the "getting around" to entail.

We can't read your mind.

ben_is_sparky
October 17th, 2005, 01:35 PM
I can't really explain very well, because I don';t really know what it Is I'm talking about. :(

You see wher it says
//******************If I trace(thispictureTitle) here, it works
and
//******************If I trace(thispictureTitle) here, it doesn't work

Why is it that within the localCOnnection Object I can't access any variables that were made ouside it and how can I use variables that have been defined outside inside it?

That didn't make sense, did it?

Barn
October 17th, 2005, 02:09 PM
Try tracing simply this in both places -- I think you'll see that they are not the same scope:


trace("this: "+this);

ben_is_sparky
October 17th, 2005, 02:23 PM
It gives [object Object] for the second one, which makes sense.
_level0.instance6.instance12.instance13.tmp_mc.thu mbContainer11
for the first, which makes sense too. (It's repeated for each movieclip that was duplicated)

How would I refer to something that is outside the object?

I tried making it a _root variable before, to try and get around it, but that didn't seem to help. Am I missing something?