I'm trying to track down a variable bug using traces (AS2.0). Could someone please explain to me what the statement in red below means and where I should look for it ? there seems to be another addressing concept that I'm missing.
scrolledMC is a MC container that holds the dynamic text field (auto sized) that is the text that is being scrolled.
scrollContent1 = _parent.scrolledMC // this statement does "_parent" refer to the original Lib item or the MC in which
trace("scrollContent1 ="+ scrollContent1)
//trace result
// scrollContent1 = _level0.instance703.instance709.scrolledMC // what does this mean? "instance" of what ? what relevance to the numbers have ?
1. how do I display the contents of "_level0.instance703.instance709.scrolledMC" in a text contents form I can read??
2. Everytime this trace runs the "instance" numbers are different. never the same numbers. so if I try to trace (_level0.instance703.instance709.scrolledMC) it comes back undefined. these numbers can get vary large the longer the swf runs and i keep coming back to the page with all the traces. Whats up with that ??
3. How is _level0 different from _root ?
4 if I trace scrolledMC I get "undefined"
Thanks
Joel
It could be easier to explain if you explain what you have created that involves scrolledMC.
The trace statement appears to be getting made from inside some object and is targeting whatever the _parent of that object is to get at scrolledMC. So scrolledMC and that object share the same _parent. Based on the output, it appears scrolledMC is living a couple of objects deep off of the main timeline. As far as what those instances are, they are whatever you have scrolledMC being planted in.
Generally, "instance"s are the names given to objects by Flash that you create dynamically or do not assign instance names to. Anything you create dynamically is numbered automatically, so the numbers can grow higher.
how _root is different from _level0... see if reading thru the following helps, or try searching Google for more explanations http://www.allinterview.com/showanswers/27769.html. Response 5 might be the more thorough explanation
If you trace scrolledMC and get undefined, it is out of scope in that trace.
Ned,
"It could be easier to explain if you explain what you have created that involves scrolledMC."
I will try to explain but I might make it worse
. I'm a noob to flash, and Unfortunately, I'm not the originator of the fla code I'm working with and it is very poorly documented and I'm trying to figure out how somebody else did something so I can make it do what I want it to.
I am converting from dynamic content loaded from a html text file to dynamic content loaded from an XML file. the reason being I'm adding content that is much easier to deal with in an XML file than &MyVar=myContent& text file. In order to be able to do this conversion I have to track down all the var assignments to text fields. 80% of this is not a problem and is straight forward. But then there are these scrolling text boxes which are a mystery. There is a single Lib item called Text_scrollerMC that is used for each instance of these scrolling text boxes on different pages. I can't switch this content over to the xml file until I figure out how it is being assigned to the different instances of the Text_scrollerMC.
So I'm trying to deterime how the content contained in the variables loaded at runtime from the html text file, are being assigned to any given instance of Text_scroller. "scrolledMC" is the part of Text_scroller that contains the actual dynamic text field that is being loaded with the var content. Each time it is filled with unique content used on the page on which it's used. The loaded content var names use the nav button name of the page in the content var name, for example on page1or "Home" page, the content in the scroller box is from var "home_txt5", on page2 it's from var "services_txt3", on page4 it's from var "members_txt7" and so on. Each var starts with the name of that page followed by "_txt" then a number. Again a direct search of the fla does NOT find ANY use of these vars by name, yet somehow these vars are being assigned to the Text_scroller when it is used on a page. I can only assume that the proper var name to use for any given instance of the scroller box is being dynamicaly "built" some how based on the scrollers location or something.
So back to "scrolledMC". As mentioned scrolledMC is the text field component of the scrolling text box (Text_ScrollerMC). Inside "scrolledMC" is the dynamic text field named "tola" that the variable content gets assigned to. The var listed in the text box properties for it's content is "home_txt1" (this is NOT a var coming from the loaded text file of vars/content). As I mentioned, Text_scrollerMC is used 6 times on different pages on the site. I'm trying to figure at what point the differnt content variables are being assigned to a particualr instance of Text_scrollerMC. besides seaching with all the actual var names I searched using "home_txt1", and using "tola" and can't find any reference to how the content is finding it's way to the text box "tola" inside scrolledMC. There is no reference to any of the var names or "home_txt1" anywhere in the fla. The only refernece to "tola" is a line telling it to "autosize". Even though "home_txt1" is listed as the var in each instance of the text box "tola" in scrolledMC, nowhere is "home_txt1" listed in the fla. I don't know why it can't be as simple as home_txt1="var for the content I want". that would make too much sense.
anyway the only way i can figure to try to track this down is to try and follow "scrolledMC" since that is where the content has to end up. soooo... in the code from the Text_scrollerMC....
scrollContent1 = _parent.scrolledMC
from what i can determined at this point _parent.scrolledMC has the var content in it cause scrollContent1 is use in the computation of the scroller movement as being the "size" of the content so _parent.scrolledMC must have "auto resized" to fit the var content cause that is the size being used in the scroller math. so I placed a trace after that line to look for clues and what i got was....
_level0.instance703.instance709.scrolledMC
I was hoping for the holy grail but instead I had no idea of what that ment which is why I was asking. I know that someplace there has to be a refence to the loaded content var in some way at some point so I'm just trying to track that down. In the above, what is "instance703" in reference to? instance of what ??
So other than trying figure out how the hell the vars are being assigned if I can't figure it out i will have to go to plan "B" which is to make each use of the Text_scrollerMC it's own complete unit and just hard code the var in each seperate use. Which will add more weight to the file which I'm trying to avoid.
Maybe I'm going about this in the wrong way? is there a way to follow the content some way to see how it's being asigned.?
the only refence to scrolledMC is in the scroller code and in a gotoAndStop statement.
onClipEvent (load)
{
oldY = 1;
Y = 1;
vY = 0;
newY = 0;
mouseWheelHitTest = true;
contentHeight = _parent.scrolledMC._height;
scrollSpeed = _parent.speed_content;
scrollStep = _parent.step_content;
viewHeight = _parent.line._height;
buttonSize = _parent.dragMC._height;
buttonY = buttonMC._y;
scrollHeight = _parent.scrolledMC._height;
scrollContent = _parent.scrolledMC._y;
scrollContent1 = _parent.scrolledMC;
newY = _parent.scrolledMC._height;
var mouseListener = new Object();
mouseListener.onMouseWheel = function (delta)
{
if (!mouseWheelHitTest || scrollContent1.hitTest(_root._xmouse, _root._ymouse, false) || hitTest(_root._xmouse, _root._ymouse, false))
{
if (buttonMC._y >= 0 && buttonMC._y <= scrollHeight - buttonSize + 1)
{
buttonMC._y = buttonMC._y - delta * _parent.mouse_speed;
} // end if
} // end if
};
Mouse.addListener(mouseListener);
hiScroll = _parent.line._height - _parent.dragMC._height;
step = (scrollHeight - buttonSize - hiScroll) / hiScroll;
y = _parent.scrolledMC._y;
}
onClipEvent (enterFrame)
{
if (_parent.drag_but)
{
if (buttonMC._y >= 0)
{
buttonMC._y = buttonMC._y - scrollStep;
} // end if
} // end if
if (_parent.down_but)
{
if (buttonMC._y <= scrollHeight + buttonSize)
{
buttonMC._y = buttonMC._y + scrollStep;
} // end if
} // end if
if (buttonMC._y <= 0)
{
buttonMC._y = 0;
} // end if
if (buttonMC._y >= viewHeight - buttonSize)
{
buttonMC._y = viewHeight - buttonSize;
} // end if
level = buttonMC._y - buttonY;
lev = int(y - level * step);
newY = oldY + (lev - oldY) / scrollSpeed;
_parent.scrolledMC._y = newY;
oldY = newY;
}
I didn't see anything here to assign content but it looks like content has been assigned before it gets here. If so I can't fine it.
Thanks
Joel
BTW Did something change about the forum ? I can seem to get to the advanced editor, there is no button for it ???
As I already said, the "instance"s are the unnamed parts of where scrolledMC lives. You just said... ""scrolledMC" is the part of Text_scroller", so those instances you wonder about are the other parts of it that contain it... they are not named manually, so the program assigns them generic names.
Yes, they are once again attempting to make the forums better (failing again as well).
Not that it will be of any consolation, but here's a couple of things you can check for...
1) Right click the object that contains the scroledMC in the library and select "Linkage" in the menu. If the object is being added dynamically, this is the most likely place to find the Identifier that is being used to call it in using code.
2) You might be able to use the Movie Explorer to find all the code elements in the file (I don't know if it works for older versions)... choose Window -> Movie Explorer (or ALT + F3)
One unfortunate aspect of AS1/AS2 files is that they allow code to be attached to objects, very effectively hiding it. This often makes it very difficult to find all of the code. You may need to click on anything that is planted on the stage to try to find it, including child objects.
Ned,
"the "instance"s are the unnamed parts of where scrolledMC lives. You just said... ""scrolledMC" is the part of Text_scroller", so those instances you wonder about are the other parts of it that contain it... they are not named manually, so the program assigns them generic names."
Well said, This made total sense to me. I went back and gave instance names to all the pieces that didn't have any and now I can see exactly what's going on as far as where the pieces are and how everything is nested. That said, i still can't figure out how the var is being assigned to the text field. there is NO "linkage" option when i right click the items in the Lib (cs5.5) and I been using Mexp but still no obvious place I can see where the content is being assign to the text field, soooo..... I decided to go with plan "C". I don't know why I didn't think of it earlier and saved a lot of this time but, Since I only have 6 of these to deal with (really just 5 cause I made one unique so i could scale the size (my earlier thread on this scroller) and since the goal here is to convert the site over to XML dynamic content, and since the scrollers do work, I just moved the content to my xml file giving it the var names I want to use there, then at runtime after the load and parsing of the xml I just did a simple var declaration where, for example _root.home_txt5 = myXML_content etc for each of the Text_scroller instances using the var names that they are expecting to find. That way my user can update the site using the XML in a way that's easy for them to understand and the Text_scrollerMC instances find the content with the vars names that it's expecting to see, and I didn't have to redo them all. Works great. It would have been nice to figure out how the content is getting assigned from a curiosity stand point, but the most important thing now is to get it done and online and in the future to stay away from AS2.
Thanks
Joel
btw I really miss the advanced forum editor. i like using color to illustrate a point and seperate things, I hate when they try to "fix" something that seemed to me to be working fine.
North America
Europe, Middle East and Africa
Asia Pacific