Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling child method from parent scene

Status
Not open for further replies.

AtomicChip

Programmer
May 15, 2001
622
CA
Here's yet another question :)

I have a movie clip that's acting as a jukebox of sorts. I've been able to successfully add the functionality in to play and switch songs. Now what I'd like to be able to do is start the jukebox playing as soon as it's loaded onto the parent scene.

I tried adding a method to the jukebox movie clip like this:
Code:
var i = 1;
function playNextTrack()
{
    var s = new Sound();
    s.loadSound("audio/track0" + i + ".mp3", true);
    
    // Set next track_id
    if(i == 2) // There are only two songs right now
    {
        i = 1;
    }
    else
    {
        i++;
    }
}

But for some reason, the method will execute, but won't actually play anything. Any ideas why?

Also, I tried calling this method from the parent scene by adding this code to the instantiated object:
Code:
onClipEvent(load)
{
    _child.playNextTrack();
}

That didn't work, so I also tried this.playNextTrack() and others.

I'm pretty much pulling my hair out over this.

Any takers?

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top