Skip to main content
Known Participant
March 2, 2014
Answered

gotoAndStop(1) question

  • March 2, 2014
  • 1 reply
  • 1028 views

i have a fla with two frames and a package.

when fla starts (frame 1) there are some functions which trigger addChild, netConection and so on,and a btn that contains gotoAndStop(2).

on frame 2 i have a btn containing gotoAndStop(1).

however when it returns to frame 1 the functions  are not triggered, children are not added and same for all functions.

how can i trigger all functions when return to frame 1 ?

This topic has been closed for replies.
Correct answer kglad

yes.

main is my document class.

package {

          import flash.events.TransformGestureEvent;

          import flash.events.AsyncErrorEvent

          import fl.containers.ScrollPane;

          import fl.controls.ScrollPolicy;

          import flash.desktop.NativeApplication;

          import flash.desktop.SystemIdleMode;

          import flash.display.MovieClip;

          import flash.media.Video;

          import flash.net.NetConnection;

          import flash.net.NetStream;

          import flash.events.MouseEvent;

          import flash.events.NetStatusEvent;

          import fl.controls.List

          import flash.events.Event;

                    public class Main extends MovieClip {

                    public var song........

                    public var song_number:String

                    public var netConnection:NetConnection;

                    private var netStream:NetStream;

                    private var video:Video;

                    private var VIDEO_URL:String;

                    public var speed:Number;

                                                                     public var speedArray:Array;

                                                                      public var prevY:Number;

                    public var DRAG:Number = 20;

                    public var HEIGHT:int = 310;

                    public var posX:int= 10;

                    public var posY:int =10;

                                                                   public var widt:int=100;

                                                                   public var high:int=100;

                    public var scroll_mc:MovieClip

 

  .......

public var pauseBtn:MovieClip

.........

                    public function Main() {


you can't call a class instantiator like that and you can't use code to call a document class, at all.

so, put whatever code you want to call using a button in another function and call that function from your document instantiator and when your button is clicked.

1 reply

kglad
Community Expert
Community Expert
March 3, 2014

you have to call whatever functions you want to execute their code.  for example:

// this code in frame one will trace "f 1" every time the playhead enters frame 1.

function1();

function function1():void{

trace("f 1");

}

udikAuthor
Known Participant
March 3, 2014

thank you

when i try to call functiom Main();

i get the error 1136: incorrect number of arguments.Expected 1.

why?

kglad
Community Expert
Community Expert
March 3, 2014

what argument are you supposed to pass to Main and why aren't you passing that argument?