A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] Creating filepath out of strings

Threaded View

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    15

    resolved [RESOLVED] Creating filepath out of strings

    I know I'm close, but can't find what I'm doing wrong.

    If I remove the variables and just type in the path name, the file does play. So there's no other error in this piece of code.
    I just can't seem to figure out how to create that filename from variables.

    If anyone could help me out I'd be very grateful.

    Thx in advance!

    EDIT: I should point out more clearly its about the line = public var soundRequest:URLRequest = new URLRequest("sounds/" + Champ + soundType + ".mp3");

    I get a 2044 unhandled ioerrorevent error and a 2032 stream error.

    Actionscript Code:
    package  {
       
        import flash.display.*;
        import flash.events.*;
        import flash.net.*;
        import flash.media.*;
       
        public class button extends MovieClip {
            public var btn1:MovieClip;
            public var btn2:MovieClip;
           
            public var Champ:String = new String();
            public var soundType:String = new String();
           
            public var soundRequest:URLRequest = new URLRequest("sounds/" + Champ + soundType + ".mp3");
            public var mySound:Sound = new Sound();
            public var soundChannel1:SoundChannel = new SoundChannel();
           
            public function button() {
                btn1.addEventListener(MouseEvent.MOUSE_DOWN, btn1Down);
                btn1.addEventListener(MouseEvent.MOUSE_UP, btn1Up);
            }
            function btn1Down(e:MouseEvent){
                trace("click");
                Champ = "Akali.";
                soundType = "joke";
                mySound.load(soundRequest);
                soundChannel1 = mySound.play();
            }
            function btn1Up(e:MouseEvent){
                trace("up");
            }
        }
    }
    Last edited by MJTheOne; 12-27-2010 at 10:07 AM.

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