A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] Strange script problem

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    119

    Angry [F8] Strange script problem

    Hello all.

    This is my situation. I have a flash file with two scenes in it. The second scene has two frames. Both frames have the stop script on them.

    In the second scene's first frame i have a movie clip and within this movieclip i have a button. The idea is when i press this button i get to the second frame (of scene 2 which im in).

    This is the script i had on it.

    Code:
    on (release) {
    	_root.gotoAndStop(2);
    }
    I have limited scripting knowledge but i thought this would work. These are the scripts i have tried:

    Code:
    on (release) {
    	_root.gotoAndStop("Scene 2", 1);
    }
    Code:
    on (release) {
    	gotoAndStop("Scene 2", 1);
    }
    Code:
    on (release) {
    	_parent.gotoAndStop("Scene 2", 1);
    }
    Code:
    on (release) {
    	_parent.gotoAndStop("1);
    }
    But it seems that if they are not working at all they all go back to frame 2 in the first scene (and not the second like i want)

    What seems to be the problem here? I feel like i tried everything.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    use a frame label on your target frame .. ie .. sc2fr2
    PHP Code:
    on (release) {
    _parent.gotoAndStop("sc2fr2");


  3. #3
    Senior Member
    Join Date
    Jul 2003
    Posts
    119
    Thanks alot that works! Another related question.

    Is there a scriptline i can add that makes the button play a sound at the same time? I have imported a 1 second wav file into my flash named "Doorlock.wav" and would like this to play when you press the button (and prefably i'd like it to play via script only and without adding another frame to the button object itself with the sound on)

    I tried adding this

    on (release) {
    Doorlock.loadSound();
    _parent.gotoAndStop("sc2fr2");
    }

    but that didn't play any sound.

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    give the sound a Linkage identifier in the Library -- ie.."doorlock"
    PHP Code:
    on (release) { 
    dlSound = new Sound();
    dlSound.attachSound("doorlock");
    dlSound.start();
    _parent.gotoAndStop("sc2fr2"); 

    note: the Sound.loadSound method is used to load an external MP3 file into a Sound object.

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