mind boggling
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: mind boggling

  1. #1
    Member
    Join Date
    Mar 2007
    Posts
    61

    mind boggling

    code:
    myMc.myBtn.onRelease = function() {
    play();
    }



    ive got that applied to a frame on my main timeline and for some reason it just wont work..

    Ive checked all instance names over and over for spelling mistakes etc..

    if i use it inside the movie clip (dropping the myMC bit and adding _parent. before play) it works fine.. and if i use the same script on a different movie clip it also works fine..

    what the hell is going on?

  2. #2
    Junior Member
    Join Date
    Aug 2007
    Posts
    1
    Humm not 100% sure what's wrong, your code looks ok. Things to try might be;
    - make sure that your code is on the first frame where your 'myMC' movie clip appears (otherwise flash doesn't know where to find your myMC movie clip)
    - try '_root.play()' instead of just 'play()', that makes sure you're playing the MAIN movie timeline

    give those a shot and see if it fixes your problem

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Location
    Mid-South
    Posts
    21
    Quote Originally Posted by EmileKelly
    code:
    myMc.myBtn.onRelease = function() {
    play();
    }



    ive got that applied to a frame on my main timeline and for some reason it just wont work..

    Ive checked all instance names over and over for spelling mistakes etc..

    if i use it inside the movie clip (dropping the myMC bit and adding _parent. before play) it works fine.. and if i use the same script on a different movie clip it also works fine..

    what the hell is going on?
    I use empty movie clips to play streamingSound . Are you playing a movie or an mp3?
    You might want to change the code to "this." this.myMC.myBtn.OnRelease = etc

    Just a thought.
    TN

  4. #4
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    yeah a good idea when using inline functions is to be sure to give yourself reference. I think your just losing scope. So one way to fix it would be to declare a variable outside of your event handler like

    var ref:Object = this;

    then in your function ,

    someBtn.somemc.onRelease = function():Void{

    ref.play();

    };

    a cleaner way would be to say


    someBtn.somemc.onRelease = mx.utils.Delegate.create(this,mcClick);


    function mcClick():Void{

    play();

    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com