69 posts
  • Bought between 1 and 9 items
  • Has been a member for 6-7 years
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
  • Author had a Free File of the Month
  • Beta Tester
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 6-7 years
+4 more
flashjunkie says
//main timeline code
ballLocation = "middleRoom";

//inside moviclip code...

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

:D

691 posts
  • Bought between 10 and 49 items
  • Canada
  • Exclusive Author
  • Has been a member for 7-8 years
  • Sold between 5 000 and 10 000 dollars
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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
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
  • Bought between 1 and 9 items
  • Has been a member for 6-7 years
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!!

3058 posts
  • Community Superstar
  • Has been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
+1 more
wickedpixel says

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

3868 posts
  • Author had a Free File of the Month
  • Beta Tester
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 6-7 years
+4 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
  • Author had a Free File of the Month
  • Beta Tester
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 6-7 years
+4 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
  • Bought between 1 and 9 items
  • Has been a member for 6-7 years
Scooby says
Check the flash help manual regarding variable paths – relative paths
Don’t be so lazy! :P

Don’t be hatin’!!!

69 posts
  • Bought between 1 and 9 items
  • Has been a member for 6-7 years
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