carnwath
04-12-2003, 07:32 PM
If you want to have a sprite designed in its own child movie and then communicate between parent /child you need to set the movies as elements in the main javascript area of the parent movie and then its name is the javascript dotted notation
PARENT MOVIE
//declare elements in the parent movie
wall = element("wall")
text = element("textbox")
mainrod = element("mainrod")
// now declare the child movies as elements
bfist = element("bigfist")
aspider = element("spider")
//declare variables in the parent movie
fist_value1 = 0
fist_value2 = 0
count = 0
edit_17 = 0
Then set the elements in each child movie
ASPIDER MOVIE
thespider = element("thespider")
BIGFIST MOVIE
fist = element("fist")
rod = element("rod")
fist.position.x = 0
fist.angular_velocity = 100
ctr = 0
ticker = 0
Then the Parent can change values in the child movies
bfist.ticker ++
bfist.rod.position.x = 20 * sin(fist_value1)
The child can change values in the Parent
root.fist_value1 = fist.position.x
root.wall.rotation = ctr
and even in other child movies
root.aspider.thespider.rotation = ctr
Hope this helps anyone wishing to control sprite movies
PARENT MOVIE
//declare elements in the parent movie
wall = element("wall")
text = element("textbox")
mainrod = element("mainrod")
// now declare the child movies as elements
bfist = element("bigfist")
aspider = element("spider")
//declare variables in the parent movie
fist_value1 = 0
fist_value2 = 0
count = 0
edit_17 = 0
Then set the elements in each child movie
ASPIDER MOVIE
thespider = element("thespider")
BIGFIST MOVIE
fist = element("fist")
rod = element("rod")
fist.position.x = 0
fist.angular_velocity = 100
ctr = 0
ticker = 0
Then the Parent can change values in the child movies
bfist.ticker ++
bfist.rod.position.x = 20 * sin(fist_value1)
The child can change values in the Parent
root.fist_value1 = fist.position.x
root.wall.rotation = ctr
and even in other child movies
root.aspider.thespider.rotation = ctr
Hope this helps anyone wishing to control sprite movies