|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Referencing a MovieClip object from within a function
I have a movie clip that loads a file. If the file contains a certain value I want to call a function and send it "this" (a reference to this movieClip object). But "this" does not refer to the object, instead it seems to be linked to the values the file has loaded.
----------------------------------------------------------------- function successFunc(success) { if(success) { if (myLoad.featured == "yes"){ _root.registerMeFeatured( this ); } } } ------------------------------------------------------------------ The above is what I have and it sends the contents of the file rather than a reference to the movie clip (which is what i would like). ----------------------------------------------------------------- _root.registerMeFeatured( this ); ------------------------------------------------------------------ The above, when used outside of the function will work properly and send the object as I would like. How can I make this work within the function? Thanks in advance. |
|
#2
|
|||
|
|||
|
Hi, what does this do?:
_root.registerMeFeatured( _parent ); |
|
#3
|
|||
|
|||
|
I tried that and it returned _level0. So I tried using ( _parent + ".nameOfMovieClip" ), and although what it returned appeared right, I couldn't use it to reference the movie clip.
|
|
#4
|
|||
|
|||
|
Hi, try out eval, it's great:
_root.registerMeFeatured(eval(_parent + ".nameOfMovieClip")); or: _root.registerMeFeatured(eval("_parent." + "nameOfMovieClip")); |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Referencing a MovieClip object from within a function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|