Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

gotoAndStop(1) question

Explorer ,
Mar 02, 2014 Mar 02, 2014

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 ?

TOPICS
ActionScript
862
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 03, 2014 Mar 03, 2014

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.

Translate
Community Expert ,
Mar 02, 2014 Mar 02, 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");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 03, 2014 Mar 03, 2014

thank you

when i try to call functiom Main();

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

why?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2014 Mar 03, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 03, 2014 Mar 03, 2014

this is the function "Main":

public function Main( ):void {

                                                            scroll_mc.y=0;

                                                            scroll_mc.addChild(A1) 

                                          A1.x=posX

                                          A1.y=posY

             A1.height=high;

             A1.width=widt;

             A1.addEventListener(MouseEvent.CLICK, next_frame1);

             scroll_mc.addEventListener (TransformGestureEvent.GESTURE_SWIPE, onDown);

                              NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

                              netConnection = new NetConnection();

                              netConnection.connect(null);

                              netStream = new NetStream(netConnection);

                              netStream.client = this;

                              netStream.addEventListener(NetStatusEvent.NET_STATUS, statusUpdated);

                              netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

                              video = new Video();

                              video.attachNetStream(netStream);

                              video.width = 600;

                              video.height = 400;

                              addChildAt(video, 0);

                                                  }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2014 Mar 03, 2014

is Main your document class?

what code are you using to call Main?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 03, 2014 Mar 03, 2014

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() {

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2014 Mar 03, 2014

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 06, 2014 Mar 06, 2014
LATEST

thank you. excellent as usual

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines