ActionScript 3.0 :: Call Functions From Within Document Class?
Jan 29, 2012
I've been away from this forum for a couple of years but finally found the time to dig into AS3. Glad to be back (although motivated by frustration)
I have a main document (Main.fla), linked to a document class named "Main" in the AS-3-settings dialog box, but named "Main.as" on my harddrive.
I also wrote a simple tracing action and saved it as "xTrace.as"[code]...
View 6 Replies
Similar Posts:
Apr 15, 2010
Call functions from document class?
View 11 Replies
Sep 25, 2011
Main is my doccument class . How can i call Main.showAlert function from Caller class.[code]...
View 5 Replies
Sep 25, 2011
Main is my doccument class . how can i call Main.Caller
package { import flash.display.Sprite; import flash.events.Event;
public class Main extends Sprite {
public function Main():void { if (stage) init(); else
[Code]....
View 2 Replies
Mar 13, 2012
while working with a server side script (php or aspx) which returns some data(from the database) can we call it in a sub-class or do we have to make the calls in the document class itself?
View 2 Replies
Aug 8, 2008
How can I run function of the main document class from a class of a MovieClip? I usually just used MovieClip(parent).function(), but now my MovieClip has another parent. Or what do I have to pass to the MovieClip class when creating the MovieClip to acess the main document class?
View 9 Replies
Apr 20, 2011
I have a Document class that instantiates a class named Other. I need to call a function in the Other class from the Document class.I'm getting this error: Call to a possibly undefined method OtherFunction through a reference with static type Other.I have read online that you need to use make the functions static or use a getter function but I'm unclear how to do that. I haven't been able to make it work and I feel like i'm missing something fundemental with this problem.below are simplified versions of the classes.
Document class
Code:
package {[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
Oct 30, 2008
I have this Class:
package {
import flash.display.MovieClip;
public class MainClass extends MovieClip {
[Code]....
I had used it as a document class, when I call the sum function from the main time line it works, but I need to call it from inside a movieclip.
View 3 Replies
Mar 27, 2011
How do I acsess public var/functions in the document class?
View 7 Replies
Aug 30, 2010
I'm basically trying to call a function that is on document class from another document class. I have a document class called Main.as in it there is a function called tester(). I need to call this function from another document class called Step1.as.[code]Does anyone know how I can call the function? I cant seen to get it to work.
View 5 Replies
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
Feb 6, 2010
I have a document class with functions that I want to access from .as files that are "included" from the timeline of movieclips.
for example, the Document Class "docClass.as":
PHP Code:
package{
public class docClass extends MovieClip
{
public function docClass():void
[Code].....
What is the correct way to call functions in the Document Class from and included .as file?
View 3 Replies
Sep 1, 2010
I'm trying to manipulate (in this particular case add eventListeners) objects (in this case some MovieClips) on the stage from a class that isn't the document class.
1120: Access of undefined property trans.
Now I know that it's probably a scope thing and I probably can't access stage objects directly from a non document class (as I'm doing in the code below) but I can't figure out how to access them properly.
Anyway, here's the deal:
I've got 3 dynamic text fields (called "NL", "FR" and "EN") on my stage in a movieclip called "trans". I'm trying to add eventlisteners in a second class to make them do something when clicked on.
Here's my document class:
package {
import flash.display.MovieClip;
// Import custom classes.
[Code].....
View 3 Replies
Feb 17, 2011
I've got a simple program that consist of a document class and a buttonTemplate constructor class. I need to call a function called updateText that should be in the document class, when someone clicks on a button. My event listeners for the buttons are in the buttonTemplate class. My question is, how do you call a function in the document class from a constructor class? Here is my simplified code below
DOCUMENT CLASS
Code:
package {
import flash.display.MovieClip;
import flash.text.TextField;
[Code].....
View 8 Replies
Jun 25, 2009
I have a function defined in my document class that I want to call on a framescript of a movieclip placed on a timeline. Of course, left to itself it's "undefined", and I can't figure out how to reference parent/root/document class.
View 4 Replies
Feb 22, 2012
I have a document class that assigns some button on the stage an function.
I have 2 cards on the stage. They have their own class.
From the buttons script i can trace the cards and i get: [object MovieClip]
But I cannot call a function in them like card_0.flipUp();
it errors:
TypeError: Error #1006: dimMe is not a function.
the card class is public starts out like:
public class FlipCard extends MovieClip {
The function is public:
public function dimMe ():void {
this.alpha = .1;
}
View 1 Replies
Nov 30, 2010
how to access loaderInfo and also call functions immediately in a class.My game is 99% there, but for this problem, whenever I run the code in the order below, I get:Error #1120: Access of undefined property root.Error #1009: Cannot access a property or method of a null object reference showMessage();[code]Is there a way I can get the loaderInfo parameters immediately, and call showMessage() if previewcard is true?
View 5 Replies
Nov 28, 2010
Im getting this error: 1180C: as3_scrollbarAS3 ScrollbarsrcclassesMain.as, Line 1 1180: Call to a possibly undefined method addFrameScript. the actionscript in my .fla timeline is: _scrollBar = new FullScreenScrollBar(_content, 0x222222, 0xff4400, 0x05b59a, 0xffffff, 15, 15, 4, true); addChild(_scrollBar)
[Code]....
View 5 Replies
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
Dec 14, 2010
I am dispatching an event from one document class and listening for it via another document class.My code in class A.
Code:
this.dispatchEvent(new MYEvent(MyEvent.APERTURE_DONE));
trace("Dispatching APERTURE_DONE");
my code in class B.
Code:
addEventListener(MyEvent.APERTURE_DONE, onDoorsOpen,true);
trace("Lisetning for APERTURE_DONE");
[code]....
My listener is registering before the event is dispatched, based on my output window, however I never get the "Open Doors" trace statement to fire.
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
Nov 25, 2010
Is it not possible to call other functions from generic mouse event functions?
Code:
_root.myButton.onPress = function(){
hide();
[code]......
View 6 Replies
Sep 22, 2008
So I had a working .fla, with a document class package in the same directory. Everything was fine, until moving both to a new directory, now the fla cannot find the document class. WTF?
View 2 Replies
Feb 3, 2009
I've started using ASDoc to document my latest project. But for some reason, it will only document one package function per package. This means that it documents one function in my utils package and then skips all the others.
Has anybody here successfully documented a utils-like package, with a ton of package functions?
View 1 Replies
Jul 28, 2011
Using Flash CS5 Professional I have created a symbol, dragged it onto the stage, and given it an instance name of GreenLight1. If I want to make this visible from the document class, I can simply do the GreenLight1.visible=true; and poof it's good to go when I test the file. As long as I stay in the document class I am good to go, but now I'm trying to move to another class and hitting ALL kinds of trouble just trying to get Flash to allow me to access this simple object. All I am looking to do is have this GreenLight1 go invisible (visible=false) when a certain condition occurs in this new class and Flash just won't let me access GreenLight1 at all. Things I've tried thus far:
stage is passed to the class and is referenced by _stage and is working just fine when I do _stage.addchild or anything like that. So I have tried "_stage.GreenLight1.visible=false;" and I get "ReferenceError: Error #1069: Property GreenLight1 not found on flash.display.Stage and there is no default value." My document class extends Sprite, so I figured I'd try the root function. So I tried "Sprite(root).GreenLight1.visible=false;" and I get "1119: Access of possibly undefined property GreenLight1 through a reference with static type flash.display:Sprite." I tried to create the Resource class as described therein. To which I came across the same problem that I started with in that it doesn't know what GreenLight1 is to begin with so I got "1120: Access of undefined property GreenLight1." Here is my code for Resource.as (am I supposed to pass something to this class from the document class?)
[Code]...
View 2 Replies
Aug 16, 2011
If I have a Document class that extends MovieClip, and I want to use it as the basis for another Document class, is it possible to create a subclass that extends the main document class and use that for a different FLA?
For example,
fla1.fla has a document class of MyMainClass:
public class MyMainClass extends MovieClip
fla2.fla has a document class of MySubClass:
public class MySubClass extends MyMainClass
I've tried, but now I'm getting errors that all of my variables that reference stage instances aren't being found.
View 1 Replies
Mar 14, 2012
Say i need to send some data from AS 3.0 to a server-side script for it to do some actions. Can I do this in a sub-class called some where in a document class or should we always do it in a document class?
View 1 Replies
Feb 3, 2009
Ok, this is one of those walls that I know once I can jump over it, I will be a much happier developer again.
I've done tons of reading, and think I have a firm understanding that the general consensus is that if you want to reference something, it needs to be added to the display list, using addChild().
I hate to be defiant, but what if I don't want to?
Or at the very least, what if I want to add a movieclip class to the stage using addChild, and then reference objects inside it?
It is much easier this way than what most people recommend - adding 15 objects via addChild, then setting the x and y for the, etc.
That said, I'm all about using classes and using as3 the way it was meant to be used. So what this is, is a best practices question I guess.
HERE ARE THE STEPS I'M TRYING:
- Create new flash document
- Draw graphic symbol bg, with text field over it, select them, convert to movieclip symbol, and export class name "box", then delete it from stage
- Add document class .as file, which simply adds that class "box" from the library, to the display list using a simple addChild()
- Set a name for that box using box.name = "test" let's say
- Do a simple trace like the following - "getChildByName('test').textFieldName" - it shows up great
- So then, I'll now try to set the text by doing this - getChildByName('test').textFieldName.text = "yo";
That last line above, is what doesn't work. I know I'm referencing wrong, but how would a pro as3 developer, reference something on the stage within a movieclip class, from the document class?
View 1 Replies
Oct 12, 2010
i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!
ActionScript Code:
var main:Main=new Main();
main.txtScore.text="hello";
View 1 Replies