Copy link to clipboard
Copied
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 ?
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.
Copy link to clipboard
Copied
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");
}
Copy link to clipboard
Copied
thank you
when i try to call functiom Main();
i get the error 1136: incorrect number of arguments.Expected 1.
why?
Copy link to clipboard
Copied
what argument are you supposed to pass to Main and why aren't you passing that argument?
Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
is Main your document class?
what code are you using to call Main?
Copy link to clipboard
Copied
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() {
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
thank you. excellent as usual
Find more inspiration, events, and resources on the new Adobe Community
Explore Now