ActionScript 3.0 :: Execute Functions In Main Document Class When Main Timeline Reaches Frame X
Oct 16, 2009
I have 3 functions in my main document class that I want to execute when the main timeline reaches a particular frame number. how do I do that?
see the code and comments
public function mainClass()
{
//stage declaraction
stage.align = StageAlign.TOP_LEFT;
[Code]....
View 5 Replies
Similar Posts:
Oct 16, 2009
I have 3 functions in my main document class that I want to execute when the main timeline reaches a particular frame number. how do I do that? see the code and comments
[Code]...
View 2 Replies
Dec 26, 2009
I've been working on flash CS3 for some time now and have learnt a lot in actionscript 3. However, I still have some very simple doubts which I want to clear:
1) Is the Document Class same as the Main Timeline?
2) If we type "trace(this)" in the actions panel on the main Timeline, it gives "object MainTimeline", is this what is the document class because there is nothing else as the mainTimeline Class.
3) If we type "stop()" in the main timeline, it stops the movie. Where does stop() belong, I mean, it is the method of which class?
4) Sometimes, when within a class or a movie clip, something like "root.gotoAndPlay" doesn't work while "MovieClip(root).gotoAndPlay()" works. Another example is when we try accessing a child of a movieClip by using getChildAt(i), "MC1.getchildAt(i).play()" does not work and we have to write "MovieClip(MC1.getchildAt(i)).play();
View 3 Replies
Jul 8, 2009
Is it possible to access the currentFrame of the main timeline from a document class (which extends movie clip)?
View 3 Replies
Mar 24, 2009
I have a new FLA with a variable in frame 1:
Code:
var testVar:String = "hello";
//--- my document class:
package
[Code]....
I just get null. How can I see a variable like that?
View 1 Replies
Jan 19, 2011
I'm trying to go to the next frame in the main timeline from a class with no luck.
I have a movieclip called winner_mc that is created in the document class.
winner_mc is linked to the Winner class.
The Winner class creates a movieclip called nextlevel_mc which is linked to the Nextlevel class.
Then when I click on the nextlevel_mc movieclip I want to go to the next frame on the main timeline.
I tried this for the Nextlevel class:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Nextlevel extends MovieClip {
[Code]....
View 21 Replies
Jan 21, 2010
How do i tell the playhead to gotoAndStop(); on frame 2 of the main timeline from a class file?....I'm trying to oop this program.
View 2 Replies
May 7, 2011
I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on).For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf. HOW do I reference the Main class? I can't find a way.[code]and dispatch an Event this way from the loaded swf document class to the Main class:[code]Now, first of all I don't know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.
View 9 Replies
Sep 7, 2010
I have flash application with main document class, components which are on the scene are instancied at runtime, contrustor of these components are call before main class, but i'd like to execute code before main class and components instanciation, how can i do this ? i tried to create an actionscript layer at frame 1 but still not work.
View 4 Replies
Nov 22, 2011
How do I link a button thats embedded in frame 2 (music page timeline) to a frame in the main timeline ( frame 3= biography page)? Both pages are on the same scene with link buttons embedded in each page independent timeline.
View 1 Replies
Apr 16, 2009
Does any one know of a way I can call a function thats set up on the main timeline using AS in movie clip thats a child of the timeline? I have a function called setName(); on the main timeline.... I also have a movieclip called contact_mc and I need to add EventListeners within the contact_mc that would some how call the setName(); function thats in its parent timeline...
View 3 Replies
Jul 14, 2009
so here's the function on main stage:
function slideImage(btnNum:Number)
{
trace("scrolling image");
trace(btnNum);
[Code].....
How can i acess slideImage function on the main stage. in AS2 _root.slideImage(btnNumber); would work. How Would I do this in AS3?
View 3 Replies
Mar 16, 2007
I simply want to assign a variable to the current frame of the main timeline (not movieclip timeline) I already know about _currentframe and it doesn't help in this case.
View 4 Replies
Apr 26, 2011
I am in the learning process. Working with FlashCS5 and AS3. if the issue appears to be too simple for you. Placed a movieclip(mcassessJohn) on the main timeline and moved to the frame labelled "johnFeedback" in the movieclip timeline using the following actionscript code.
[Code]...
View 1 Replies
Apr 1, 2011
I have a document class called Main.as In the class constructor I have the following listener:
enter code here
var listeningFORModeChangeToStudent:Sprite = new Sprite;
listeningFORModeChangeToStudent.addEventListener(TellAllModeChangeToStudent.STUDENT,exp);
addChild(listeningFORModeChangeToStudent);
[code]....
In a third class I make a call to the despatcher in the previous class:
enter code here
var ThisTellAllModeChangeToStudent:TellAllModeChangeToStudent = new TellAllModeChangeToStudent;
ThisTellAllModeChangeToStudent.tellAllModeChangeToStudent();
I have trace statements in eveything and from this I know the despatcher in TellAllModeChangeToStudent is being called.The problem is that the listener in the main.as is not calling the function exp.I cant see why and I dont know how to check if the listener is actually seeing the dispatch event?
View 1 Replies
Sep 10, 2009
I'm using document classes, and I've created a separate class to create many objects, with graphics and events, strings, etc. But I'd like to be able to add an event listener inside it that will call a function inside my Main document class..
Edit: or even have classes communicating with other classes.Having classes seems to cut off things from other things.
View 5 Replies
Feb 17, 2011
Even I am programmer I am very, very, new to as3.
Problem: I have define a classA in aA.sp file.
package{
import flash.display.Sprite
.......[code]...........
When test on cs4 (contol>enter) I get following error 1061: Call to a possibly undefined method playVideo through a reference with static type flash.display:Sprite
View 2 Replies
May 2, 2010
In Flash CSn/AS3 you associate a Main class with a flash file which when loaded in the flash player "automatically creates an instance of the program's main class."I'd like to know how to pass arguments to the main class, since you don't write it yourself (you put its name in the Document textfield in the IDE).
View 1 Replies
Jul 8, 2009
I am trying to rebuild an AS2 navigation in AS3. I built a button class (PortfolioNavItem.as) and a navigation bar class (PortfolioNav.as). This works if I use PortfolioNav as the Document class. However, I want to do things the proper way and call PortfolioNav from a Main document class (Main.as) but when I try it I keep getting that Error #1009.
Main.as
package com.tagehaun {
import flash.display.Sprite;
//import com.tagehaun.PortfolioNav;
public class Main extends Sprite {
//public var portfolioNavItem:Sprite = new Sprite();
public var portfolioNav:PortfolioNav = new PortfolioNav();
[Code] .....
View 0 Replies
Dec 16, 2009
I have a main movie with thumb movieclips that load new children and stops the main movie's animation. Within the child there is a close buttion that removes itself. I also wanted the close button to start the animation of the main movie again once it removed the child. Since I am using a document class to load everything for the main move, how can the close button from the loaded swf use a function from the main document class?
View 5 Replies
Jan 13, 2009
I'm trying to dispatch a custom event. So that my main document class can react when a nav button is clicked.I have a navbutton class which creates the dispatch's the event... and is handled by the onNavigate Method...
private function onClick(evt:MouseEvent):void {
//trace(_label.text + ": path = " + _projectNode.@path);
//trace(evt.target._label.text);[code]....
This onNavigate method works perfectly.... however when I try to create a listener in my main document class I don't "hear" the event.Here's part of the code from the main doc class...here's where I register the listener
this.addEventListener("NAVIGATE", doSomething);
here's where I should handle it...
private function doSomething(e:Event) {
trace(e.target.name);
trace(e.target._label.text);
View 12 Replies
Feb 28, 2011
I need to access successfully loaded XML data from the main document class BUT from objects multiple levels deep. I could hack around this setting properties deep down from the top but it doesn't seem like good practice. Is there a better way?
View 4 Replies
Mar 11, 2012
I have 3 dynamic textfields that are added to the stage through an external class, (I only add the main container from the Main.as) the textfields are nested under 5 MCs (that's what i see when i list objects in the debugger) how can i access those textfield from the Main document class?I've tried by path, by getchildbyname, i've exported the font for AS (the textfields have instance names)... and nothing works, i either get an error or it tells me it has no properties, or null..
View 14 Replies
Apr 22, 2009
So I have a frame labeled 'init' and a button called _exit. I want _exit on click to keep going back until it reaches 'init'
I'm guessing something like this but it doesn't work:
[AS]_exit.addEventListener(MouseEvent.CLICK , function(e:Event):void
{
if(currentFrame!='init'){
gotoAndPlay(currentFrame-1)
}
});
[/AS]
View 1 Replies
Aug 27, 2009
How do you go to a frame in the main timeline?I tried stage.gotoAndStop(2); but that did not work.
View 4 Replies
Feb 13, 2010
Whenever I hit the enter key, the main timeline goes to the next frame. I don't want this to happen -
View 1 Replies
Jan 5, 2010
How do you retrieve the frame rate for the main timeline that was set when the SWF was created.
var fr = MovieClip(root).frameRate
...does not work for me.
View 1 Replies
Apr 1, 2011
I just added a motion tween on the main timeline only to realize it doesn't run. Only frame 1 is executed, including its AS3 code. No I could not locate any stop() command within the AS3 code.
View 5 Replies
Apr 2, 2011
I made an RPG, and I'm trying to make the movie itself go to the second/next frame. But whenever I try to do that, nothing happens at all. I tried _level0.gotoAndStop(2) and _root.gotoAndStop(2), both on a frame and on a movie clip.
It's suppose to initiate this function once a certain variable (_root.numbers) reaches 20, and I've tested if the variable does reach 20 by doing other things.
View 0 Replies
Apr 28, 2011
What would be the best way to move onto the next frame (frame 2), when an animation has finished playing on the first frame in the main timeline, with no user input? The animation is on the first frame in the form of a nested movie clip.
View 2 Replies