69 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 1+ items on Envato Market
Scooby says

Say I have this code on a frame on the main stage:

ballLocation = middleRoom;

Then, inside a movieclip, on frame 1 I have an if statement:

if (ballLocation == middleRoom) {
    trace ("middleRoom");
} else {
    trace ("centerRoom");
}

I just cant seem to figure out how to get the if statement to run its condition so that it traces “middleRoom”..

3868 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
flashjunkie says
//main timeline code
ballLocation = "middleRoom";

//inside moviclip code...

if (_parent.ballLocation == "middleRoom") {
    trace ("middleRoom");
} else {
    trace ("centerRoom");
}

:D

691 posts
  • Has been part of the Envato Community for over 7 years
  • Has sold $5,000+ on Envato Market
  • Located in Canada
  • Has collected 10+ items on Envato Market
+2 more
geoken says

FJ, I noticed your avatar looks like it has a transparent background.

Does the site support images with alpha channels for the avatar or did you match the background color of your avatar to FD’s background color?

723 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
BigZ says

the background is matched the FD color:

http://activeden.net/files/17144.jpg?1199446810

Isn’t it possible to upload a png with no background? I think it should.

69 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 1+ items on Envato Market
Scooby says
//main timeline code
ballLocation = "middleRoom";

//inside moviclip code...

if (_parent.ballLocation == "middleRoom") {
    trace ("middleRoom");
} else {
    trace ("centerRoom");
}

:D

Thankyou very much.. That works perfectly, but now that I test it on my movie I guess its not exactly what I was looking for.. I need a way to load the variables value inside the movieclip onto a movie clip.. haha Let me try to explain.. I have 2 movieclips.. One on main stage named “mc_1”, and inside that one another named “mc_2”..

code on frame of main timeline:

ballLocation = "middleRoom";

code inside movieclip ON the movieclip as well:

onClipEvent(load){
// What code would load the value here of ballLocation on the main timeline?

}
onClipEvent (enterFrame) {
    if(_root.mc_1.mc_2.hitTest(_level0._xmouse,_level0._ymouse,true)){
        if(ballLocation == "middleRoom") {
            trace("middleRoom");
        } else {
            trace("centerRoom");
        }
    }
}

I hope that’s understandable.. Thanks a million!!

3072 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+5 more
wickedpixel says

Check the flash help manual regarding variable paths – relative paths
Don’t be so lazy! :P

3868 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
flashjunkie says
onClipEvent(load){
// What code would load the value here of ballLocation on the main timeline?

}
onClipEvent (enterFrame) {
    if(_root.mc_1.mc_2.hitTest(_level0._xmouse,_level0._ymouse,true)){
        if(_parent._parent.ballLocation == "middleRoom") {
            trace("middleRoom");
        } else {
            trace("centerRoom");
        }
    }
}

that should be what you are looking for i think :D

My avatar is matched to the FD color scheme :D

Jay

3868 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
flashjunkie says

scope can be a pain at times, lets say i have this…

RootTimeLine – Variable held here

Movieclip One Timeline – i would use _parent to access the variable

Moviclip One Code ON the movieclip, i would again use _parent to bring the scope back to the main timeline

so if i have a movieclip inside movieclip one and i place the code ON that movieclip i would use _parent._parent the first _parent scopes to the movieclip one timeline and the second _parent brings the scope to the root timeline, u could also use _root. to access the main timeline but _parent is better as it stops any conflicts if a file is dragged and dropped onto another file :)

i hope this makes sence to you my friend :)

Jay

69 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 1+ items on Envato Market
Scooby says
Check the flash help manual regarding variable paths – relative paths
Don’t be so lazy! :P

Don’t be hatin’!!!

69 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 1+ items on Envato Market
Scooby says
onClipEvent(load){
// What code would load the value here of ballLocation on the main timeline?

}
onClipEvent (enterFrame) {
    if(_root.mc_1.mc_2.hitTest(_level0._xmouse,_level0._ymouse,true)){
        if(_parent._parent.ballLocation == "middleRoom") {
            trace("middleRoom");
        } else {
            trace("centerRoom");
        }
    }
}

that should be what you are looking for i think :D

My avatar is matched to the FD color scheme :D

Jay

I’m sorry to bother you again, but I don’t see what you meant on this one??

by
by
by
by
by
by