Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
0Visual #1
Referencing Objects using 'This'
Here is my problem i have a class called test and in that class I have a
function called loadxml. So it looks something like:
class test
{
var username:String = 'vince';
function loadxml()
{ var moxml:XML = new XML();
moxml.onLoad = handlereturn;
moxml.load('uiconf.xml');
}
function handlereturn()
{
trace(this.toString());
trace(username); //this will not work because of lose of scope
}
}
Ok how can I refence back to the object from the handlereturn. The
handlereturn has no idea which instantiated object sent the load call. In
Flash MX I was able to do:
moxml.parent = this;
I would do this prior to load xml. Then the handlereturn should be able to
call this.parent and have reference back to the object. How do I do this in
2004. I tried extending the XML calls and added on member variable called
moparent. The variable moxml became an instance of this new class (let's say
sXML). However the handleresults cannot access the parent. I get a compile
error saying no property.
Anyone know of a quick and efficent way of doing this. I guess what I am
trying to do is regain scope.
Vince
0Visual Guest
-
Newbie Question? Aligning Objects to other Objects?
Hi, I think this a newbie question and I will try to explain it as best as possible! I have a hollow circle (no fill, or stroke) and x amount of... -
Referencing Movie Clips / Objects
I have a form composed of Movie Clips of type Input Text which all have a unique instance name. I want to be able to call each of those input... -
Storing Objects/Arrays in Stored Objects
Hello All, I recently came across a very frustrating issue when trying to create and store arrays within objects in a Shared object. It took me... -
Referencing Clicked Objects
Perhaps a silly question since I am new to actionscript ... but: Is there a way to refererence a clicked object (=button) within an on (release)... -
referencing problem, or so i think
// Hi I can't seem to pass the right instance to the function move Make_bg() //initiate... -
James Fee #2
Re: Referencing Objects using 'This'
ok, I ran into this and this is going to sound really weird, but it works.
class test
{
var username:String = 'vince';
function loadxml()
{ var moxml:XML = new XML();
moxml.onLoad = handlereturn;
moxml.__proto__._parent = this;
moxml.load('uiconf.xml');
}
function handlereturn()
{
trace(this.toString());
var myParent:Object = this._parent;
trace(myParent.username); //this will not work because of lose of
scope
}
}
"0Visual" <webforumsuser@macromedia.com> wrote in message
news:c287s7$j7s$1@forums.macromedia.com...to> Here is my problem i have a class called test and in that class I have a
> function called loadxml. So it looks something like:
>
> class test
> {
> var username:String = 'vince';
>
> function loadxml()
> { var moxml:XML = new XML();
> moxml.onLoad = handlereturn;
> moxml.load('uiconf.xml');
> }
>
> function handlereturn()
> {
> trace(this.toString());
> trace(username); //this will not work because of lose of scope
> }
>
> }
>
> Ok how can I refence back to the object from the handlereturn. The
> handlereturn has no idea which instantiated object sent the load call. In
> Flash MX I was able to do:
> moxml.parent = this;
> I would do this prior to load xml. Then the handlereturn should be ablein> call this.parent and have reference back to the object. How do I do thissay> 2004. I tried extending the XML calls and added on member variable called
> moparent. The variable moxml became an instance of this new class (let'scompile> sXML). However the handleresults cannot access the parent. I get a> error saying no property.
>
> Anyone know of a quick and efficent way of doing this. I guess what I am
> trying to do is regain scope.
>
> Vince
>
James Fee Guest
-
0Visual #3
Re: Referencing Objects using 'This'
I get a compile error telling me the _proto_ cannot me found. Is your example
based on ActionScript 1.0? In Actionscript 2.0 you can't do this. That's why
I tried to extend the XML class to included this new variable.
0Visual Guest



Reply With Quote

