A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: can anybody tell me what is wrong with this code?

  1. #1
    Member
    Join Date
    Jun 2008
    Location
    Amman, Jordan
    Posts
    44

    Question can anybody tell me what is wrong with this code?

    Hi,
    I'm creating a simple sound component that plays a sound file in the library, it takes V_Source parameter as the linkage name in the library, and V_Button parameter as the name of the button that will play the sound.

    var soundClass = flash.utils.getDefinitionByName(this.V_Source) as Class;
    var currentlyPlayingSound = new soundClass();
    var currentSoundChannel = new Object;
    MovieClip(parent)["this.V_Button"].addEventListener(MouseEvent.CLICK,PlaySound);
    function PlaySound(event:MouseEvent) {
    currentSoundChannel = currentlyPlayingSound.play();
    }



    I have this error:

    TypeError: Error #1010: A term is undefined and has no properties.
    at SoundRepeater_fla::Symbol1_1/frame1()

  2. #2
    Member
    Join Date
    Jun 2008
    Location
    Amman, Jordan
    Posts
    44
    sorry
    I find what is wrong, this is the right code:


    var soundClass = flash.utils.getDefinitionByName(this.V_Source) as Class;
    var currentlyPlayingSound = new soundClass();
    var currentSoundChannel = new Object;
    MovieClip(parent)[this.V_Button].addEventListener(MouseEvent.CLICK,PlaySound);
    function PlaySound(event:MouseEvent) {
    currentSoundChannel = currentlyPlayingSound.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