ActionScript 3.0 :: Communicate Functions In Different Classes?

Mar 13, 2009

I have 2 classes

Code:
package com.MyClass.basics1
{
//importing classes to use[code]...

Is there any other way to reference a function ?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Can't Communicate Between Classes

Oct 30, 2010

I'm new to as3 programming and I'm trying to communicate between two classes to get the player coordinates for a game from one class to another class. I tried using a getter and a setter and calling a class public function that returns the value.[code]...

View 3 Replies

ActionScript 3.0 :: How To Communicate Between Classes

Mar 4, 2011

How you can communicate between class's. E.g. Assessing a function from 1 class in another. And accessing variables from 1 class to another.

View 9 Replies

ActionScript 3.0 :: Classes Communicate With Each Other?

Jul 8, 2011

I am still wrapping my head around AS3 classes and how to use them..i want to know how classes can communicate with each other and send information to each other? Below I have created an example of 2 classes inside of a package. When 1 class is finished it triggers the other to start.

Code:
package
{
import flash.utils.Timer;[code]........

View 6 Replies

ActionScript 3.0 :: How To Communicate Between Classes?

Dec 4, 2009

I am trying to make a little game. In short words; you control a instance named player, and get attacked by children of the Enemy class.How can all the children of "Enemy" know the coordinates to player instance, how can the document class and the Enemy class exchange variables?

View 14 Replies

ActionScript 3.0 :: Can't Communicate Between Mc's External Classes

Feb 15, 2011

if one can't communicate between mc's external classes how can you create stuff?I have a timer inside each instance form a bomber_mc via a external class:this timer places bom_mc's on the stage from the location of bomber_mc (there are several). But I want to do a do a collisiondetection test with each bom and yet another kanon_mc.can you give me a hint in the right direction?

View 14 Replies

ActionScript 3.0 :: Basic Way To Communicate Through Different Classes?

Jul 3, 2011

I've had C# lessons in class and saw some basic class functions. Now however it's been a while since I worked with AS3. And it seems I can't figure out a basic way to communicate through different classes. I'd hoped I could do something like level.backgr1.x += 5; Where backgr1 is a MC defined in the class Level. I'll explain the thing I want to accomplish. I have a 3 classes, Main, Player and Level. Player and Level are children of Main. the mc in Level needs to move when a keyboard event occurs in Player. But only Main can acces Level because it is it parent.

View 2 Replies

ActionScript 3.0 :: Communicate Between Two Movieclip Classes?

Oct 21, 2011

I have a question that doesn't seemt too complex, but I am unable to find the answer probably because I don't know what to search for.

I just don't understand how to communicate between two movieclip classes.[code]...

View 5 Replies

Actionscript 3.0 :: Communicate Between 2 Document Classes?

Aug 31, 2010

I have 2 different swf files with their own separate document classes. My first SWF file is main.swf and it's document class is called Main.as (its the main container that loads in external swfs). The file being loaded into main.swf is called step1.swf and it's document class is called Step1.as. I have a next button in step1.swf that when clicked needs to tell the document class controlling my main.swf (ie Main.as) to load in the next external swf. However I don't know how to call a function in one document class to from another document class. And I don't know if that fact the swf calling the function being loaded into the other makes this situation more complicated. I've looked around but I cant seem to find the answer anywhere. Basically I need these two separate document classes to communicate between one another.

Here is the code for Main.as (the doc class for the container SWF):

Code: Select allpackage
{
import flash.display.*;
import flash.events.*;

[Code].....

how to get swfNavigation() to run from the other class

View 1 Replies

ActionScript 3.0 :: Communicate Between Custom Classes?

Jun 26, 2008

I've started to work with Actionscript 3.0 for a couple of weeks and I've just started my very first "top-to-bottom" AS3 project which I'll be delivering (a "demo") next Monday.However, some basic complications are arising and I just don't know what to do, this probably has been answered a lot of times but I can't seem to find a single blogpost/forum/website that addresses this issue in a way that I can understand instead of "copy/pasting" code.[code]Ok, when I press a button inside the NavBar class I want it to execute a function that tells the DocumentSetup generated MovieClip(contentLoader) to load in a different SWF based on the arguments passed on the Event.My questions are:

1 - How do I access a public function on a different class? Let's say I have my navFunction() placed on the DocumentSetup Class, do I need to create "another" instance of the DocumentSetup Class just to tell it to do something?

2 - Let's say you're able to explain to me how to solve the problem above.How can I reference a MovieClip generated by the DocumentClass through another Class? I need something to tell the contentLoader MovieClip to change contents, how do I communicate with it from another Class if the MovieClip was added to the DisplayList through code on the DocumentClass?

3 - How can I create a Variable which is identified throughout the website, let's say I have an XML file with all the text content that's going to fill in the content placeholder's. How do I make this XML data accessible from all classes instead of having to re-import the XML again and again?

My external classes all work 100% themselves but I cannot get them to communicate with each other, I keep getting compiler errors...A website in which you can't navigate to a different page is basically useless

View 14 Replies

ActionScript 3.0 :: Communicate Between Document Classes?

Aug 30, 2010

Let me explain the situation that has been driving me crazy the last couple of hours. I have 2 different swf files with their own separate document classes. My first SWF file is main.swf and it's document class is called Main.as (its the main container that loads in external swfs). The file being loaded into main.swf is called step1.swf and it's document class is called Step1.as. I have a next button in step1.swf that when clicked needs to tell the document class controlling my main.swf (ie Main.as) to load in the next external swf. However I don't know how to call a function in one document class to from another document class. And I don't know if that fact the swf calling the function being loaded into the other makes this situation more complicated. I've looked around but I cant seem to find the answer anywhere. Basically I need these two separate document classes to communicate between one another. Here is the code for Main.as (the doc class for the container SWF):

[Code]...

if someone can show me how to get swfNavigation() to run from the other class

View 2 Replies

ActionScript 3.0 :: Passing Functions Through Functions From Different Classes?

Dec 27, 2009

Let's I have a class Square that has a several functions. I want to call it from a class Grid, which is a group of Squares.So in the class file for Grid, how would I do this:

Code:
public function doSquareFunction(thisFunction:Function):void{
square1.thisFunction();

[code]......

View 8 Replies

C++ :: Communicate Between AIR(Flex) And Applications - Call Functions And Pass Arguments To Each Other

Sep 30, 2009

I need to be able to communicate between two applications that reside on the same machine. One is using Flex and the other is in C++. I would like to be able to call functions and pass arguments to each other. What is the best way to communicate between them?

View 3 Replies

ActionScript 3 :: How To Use Functions From Different Classes

Apr 3, 2012

I have 2 classes, named Class1 and Class2. How would I use a function from Class1, in Class2?

View 4 Replies

ActionScript 3.0 :: Using Functions In Other Classes?

Jan 5, 2010

so I'm having this problem where one of my classes can't locate a function. The function it's trying to use is in another class, so I was wondering if there was something special you had to do. This is what I'm basically doing:
One class

Code:
package
{

[code].....

View 5 Replies

ActionScript 3.0 :: Passing Functions From Different Classes?

Dec 27, 2009

Let's I have a class Square that has a several functions. I want to call it from a class Grid, which is a group of Squares.So in the class file for Grid, how would I do this:

Code:
public function doSquareFunction(thisFunction:Function):void{
square1.thisFunction();

[code].....

View 5 Replies

ActionScript 3.0 :: Sharing Functions Between Classes?

Mar 9, 2009

I have Flash project that is set up something like this:

myProject.fla

- document class = myMenu.as

- the document class imports a menu item from menuItem.as (import menuItem;)

I have a function in myMenu.as that sets the text formatting for all the text fields on the page. I want to be able to use this same function in menuItem.as so that all the formatting is consistent & you only have to change it in one place. How do I access this function from both myMenu.as & menuItem.as?

View 2 Replies

ActionScript 3.0 :: Move Some Functions Into Their Own Classes?

Dec 17, 2010

okay, i'm refactoring a huge ActionScript file, and so trying to move some functions into their own classes.  why is this not working?  i've got a function in my primary class:

// ...
private var testBlock:Sprite;
public function testingINT() {
testBlock = new Sprite();

[Code].....

View 11 Replies

Flash :: Access Different Functions Between Classes?

Dec 13, 2011

I'm coding a small flash game, and wan't to access different functions between classes. In C# I'm used to just making it static, but I'm having some problems with it.Here goes:

Main.as
package
{
import Bus;[code].............

View 3 Replies

ActionScript 3.0 :: Call Functions In Different Classes?

Oct 27, 2009

I need to call a function that sits in a class called MainClass.The function call is made inside a class called Rooms.

I have an event that is supposed to call the function, but when I do I get[code]...

View 2 Replies

ActionScript 3.0 :: Passing Functions Between Classes?

Oct 27, 2009

This probably has a simple solution, but I'm a complete newb to actionscript and I could really use some guidance.I have a file, called Politismos.fla. The document class of this file is: com.plaidfox.PolitismosClassPolitismosClass.as is as follows:

ActionScript Code:
package com.plaidfox {
import flash.display.MovieClip;

[code].......

View 9 Replies

ActionScript 3.0 :: Accessing Functions In Other Classes?

Sep 8, 2011

I've been working my way towards better OOP design lately and I've come across a problem with accessing functions in other classes from my Main class. Here is the code:

Main.as

ActionScript Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fireBullet);

They are listening for functions that are within the Player.as class, these functions control the dynamics/movement of the player itelf. But for some reason I'm getting a 1120 error(access of undefined property). Basically how do you listen/access for functions within a different class?

View 5 Replies

ActionScript 3.0 :: Pulling Functions From Other Classes?

Sep 10, 2011

asically I have a Player class with methods (i.e. Moving the player) that I want to listen for and implement in the main class. To put it simply, I'm creating the player methods in the player class and then calling them in the Main class. But for some reason I'm having some trouble, I'm still trying to get used to all this OOP design.Here is the (Main) code, it's not alot:

ActionScript Code:
package
{

[code].....

View 9 Replies

ActionScript 3.0 :: Call Functions From Other Classes?

Mar 12, 2010

in my Main class, i try to call a function from another class, but when i compile i get this error:1136: Incorrect number of arguments. Expected 1.i have seen some fixes involving an event in the OtherClass and (null) when i call it, but it dosent seem tohere is a code that describes my problem, what do i have to do to make this kind of code work?m i doing it wrong, or do i have to do something else?OtherClass

Code:
package{
import flash.display.*;

[code].....

View 3 Replies

ActionScript 3.0 :: Call Functions And Classes From Variables?

Oct 20, 2009

I was wondering if ActionScript had some way to call functions and classes from variables, like they do in PHP:

function funcname() {
print "Potatoes come from tree";
}
$function = "funcname";
print $function;   // Prints out "funcname"
$$function();      // Prints out "Potatoes come from tree"

In case you don't know the syntax for PHP, you should know that anything perpended with a $-symbol is a variable.

View 1 Replies

Flex :: Add Classes And Functions To Loaded File?

Dec 17, 2009

I have a flex application that loads swf files and displays them using the SWFLoader object.is there a way to provide different classes and functions for the swf application to use? [code]...

View 1 Replies

Xml :: Structure Classes To Avoid Using Static Functions?

Nov 16, 2011

I have a Flash application that creates a sort of powerpoint presentation. All the 'slides' are stored in an XML files which is read and processed.

I'm trying to build the presentation using this XML file. At the moment, my main class has it's initial function main and a static function processXML main initiates my database class with a function called initDB. One of my issues is that initDB forgoes processing because it's dependant on an event listener. On completion of loading the XML files, the event listener initiates my static function on my main to create objects from this file.

The issue is that because the event listener continues the processing (after an indeterminate amount of time), the functions are no longer controlled by the main class.

[Code]...

View 1 Replies

ActionScript 2.0 :: Functions In Object Oriented Classes

Aug 4, 2009

I'm new to the object oriented stuff and I'm trying to learn how it works. Here's what I've started on - it's led to a few dilemmas. I have one flash file and two .as each with one class. In the timeline of the fla file, it reads:
ActionScript Code:
var FileObject:ScriptFile = new ScriptFile();
function onEnterFrame(){
FileObject.CallInput();
}

Call input is a function in "ScriptFile.as" that calls another function in "Input.as";
ActionScript Code:
class Input{
public function Input(){
} public function keyListener(target:Number):Number{
[Code] .....

In output, when I press Left, it will say -5 over and over again, and I'm trying to add to xpos value but that isn't happening.

View 1 Replies

ActionScript 3.0 :: Asynch Or Callback Functions Between Classes?

Apr 26, 2009

Im trying to load some data, but I want to outsource the job of data loading to different classes.lets say XMLLoader class will get the url and return an xml file. The problem now is that such procedures are asynchronous, the class has to wait for XML to load and then call back the caller class and return the xml data.One way of doing this, is returning the data with a custom event. once its loaded then dispatch this event with the data in. However, I was wondering, if there is a way to do it with some sort of asynch call, meaning the caller class sends the request, then waits for a response.is such a thing possible? is there a better way or do I need to stick to my custom events?

View 2 Replies

ActionScript 3.0 :: Constructor Functions Of Multiple Classes?

May 16, 2009

I have a rather general question regarding OOP. How do constructor functions execute with multiple class extensions? I'm making an orbital physics simulation, and every spatial body is of the class SpaceObject, which extends Sprite. Then, I have all earth-type planets be of the class Earth, which extends SpaceObject. There are certain parameters that I'd like to set for every single SpaceObject (like position and size) in the constructor function, and certain parameters (like density and mass) that I'd like to set in the constructor of class Earth.But from the main timeline, when I create an instance of class Earth, I can only enter the parameters of the Earth constructor, ie

Code:
var planet1:Earth = new Earth(density, mass)
Or I can create an instance of SpaceObject:

[code]......

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved