Actionscript 3 :: Communication Across Different Classes?

Apr 1, 2010

I always have the trouble that make different classes communicate with each other.

1. using get set methods

2. eventdispatch to dispatch custom event.

Today, I am working on this confused issue again. I still can't get through it.this time what I wanna do is this: I wanna use a button (_zoom) to control a mc (_board) located in different class. Let's me give a simple structure for you:

ProjectAppear.as
|_ _board (mc)
|_ Project.as
|_ _work (mc)
|_ _zoom (mc)

My thought is I add a mouse event listener for _zoom, and then when mouse click it will dispatch a custom event..

View 2 Replies


Similar Posts:


Actionscript 3.0 :: Communication Between The Classes?

Feb 21, 2008

Im building my first OOP project with classes in AS3, Ive done a lot of tutorials and Im grasping the concepts well. Im just having trouble with the concept of communicating between classes. Whats the best way for a class to talk back to its parent once its instantiated? It seems when your inside a class, you're kinda stuck there as far as scope goes? ie one way street. Or am i missing something? Im used to the days where I was coding on the timeline and could just use this._parent etc. But obviously those days are gone.Or should I not need worry about this If I have planned the structure/heirachy correctly?

View 14 Replies

Actionscript 3.0 :: Communication Between Sibling Classes?

Apr 16, 2009

I had a question on OOP and the best practice for how to communicate between classes. If I have a class (SiblingA) where some one clicks something in it and you need to interact with another Class (SiblingB), what is the best method for doing this?

(option1) Should I have a bunch of event listeners in the Document Class that respond to these events? (I thought you wanted a document class to be as small as possible). (option2) Or should I create a separate 'Utility' class that speaks with both siblings to facilitate communication (event handling) between the two (one class with many public static methods). I have attached a diagram to try and help explain this.

Often times these events are dispatched from children of children in sibling classes (ie childOfSiblingA or even its children) Option1 Scenario: A user does something in SiblingA, that dispatches an event to the doc class which listens for it, fires its listener function which calls a (public) method in SiblingB to handle the interaction.

Option2 Scenario: A user does something in SiblingA which calls a (public static) function in Utility class which calls a (public) function in SiblingB to handle the interaction.

I think I am leaning towards option 1 but that would be a lot of dispatching events (child dispatches to parent, dispatches to its parent, dispatches to doc, doc calls child, which calls its child, which... finally does something)

View 6 Replies

ActionScript 3.0 :: Communication Between Variables In Other Classes?

Jul 19, 2011

I need to know how to reference variables in other classes. I have been avoiding this by referencing variables from the Main class, where they are created. But at this point I would like to be able to have the option and it would make me a better programmer.

Say I create a movieclip in the Main.as

Code:
public var Enemy_mc:Enemy = new Enemy();
addChild(Enemy_mc);

[Code].....

How do I do that^ without creating a variable in Main.as and having it check Background.as for variable updates?

Can I do something like "Main.Enemy_mc += 5;" like I can do in Main.as to variables that I have created in Main in other classes?

View 2 Replies

ActionScript 3.0 :: Communication Between Classes And Performing Action

Jun 2, 2009

I don't know how to phrase this, but as you can see my code below I have 2 classes.
1. wp_title
2. wp_date

How can I let wp_date to get the height of wp_title's contentText? Currently I tried tracing wp_title.height from wp_date but all I get was 0, I guess it doesn't get the height after wp_title finish loaded. Currently the classes will perform an action after I resize the stage. I assume if I'm able to get the classes to communicate with each other than I could have 1 main classes to control the actions perform in other class?

Code:
package {
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.StageScaleMode;
import flash.events.Event;
[Code] .....

View 5 Replies

ActionScript 3.0 :: Error# 2025 And Classes Communication Again

Sep 9, 2009

1. I've created a menu which works almost what I want, but after I click a button and roll over to other buttons, it would show error. It show the error at the output panel but everything still working fine

Code:
private function bgGlow(event:Object):void {
//Disable menu below
event.parent.button.visible=false;

[Code]....

View 3 Replies

Actionscript 3 :: Local Playback Security Setting In Flash For Outside Communication With Inside As-classes?

Dec 14, 2010

I'm using external actionscript files located in the root of my webfolder, but I also want to communicate with another website.

How should I set my Local playback in publish settings? Access Local Only? or Access Network Only?

View 1 Replies

Auto-import As3 Classes (internal/intrinsic Flash Player Classes At Least) Using Emacs?

Aug 23, 2011

Is there any way to auto-import as3 classes (internal/intrinsic Flash Player classes at least) using Emacs ?

Looked for as3-mode and actionscript-mode but nothing working was found. as3-mode can import class if it is opened in buffer (but not *.mxml files)

View 1 Replies

ActionScript 3.0 :: Unexpected Errors, Multiple Helper Classes, Extended Classes?

Jan 9, 2010

The examples I'll use don't do anything - they're classes without ANY members - no variables, methods, anything.

Let's say I extends Sprite and call it MySprite.

I save it in test.core

[code]...

Now I create another custom class called MyWindow that extends MySprite.

I save it in test.windows

[code]...

Then I create another class that extends MyWindows (the example I'll use is a document class - but that doesn't matter - I've tested using an instance too).

[code]...

Notice that I'm not even trying to instantiate the helper classes - just having them there throws the error.

If there is only a single helper class, everything runs fine.

Also note that - as far as I can tell - this only happens when extending one class from another package, then extending that class with more than one helper object.I'm pretty sure there's no namespace bumps or typographical errors, as this is a very pared-down version of the original application.

EDIT: seems the problem exists even without the crossing packages - even extending MySprite in the document class with multiple internal classes generates this error.

View 4 Replies

Actionscript 3 :: Inside The Library Use Of A Bunch Of Classes/packages - Expose One Of These Classes?

Feb 3, 2012

I am creating a library in AS3. Inside the library I make use of a bunch of classes/packages that need not be exposed to the end user of my lib. I want to only expose one of these classes.

I guess my questions are:

1) How are libraries commonly distributed in AS3?

2) Is there a .jar equivalent in AS3 that developers can include, but will only have access/knowledge of the classes I've declared as public?

View 2 Replies

Actionscript 3 :: Classes In Project Override Classes In A Flash CS3 SWC File?

May 6, 2011

I have an actionscript project which uses visual symbols from an SWC. I have a CheckoutButton which has the following class associated with it (compiled into the SWC in Flash CS3).

[Code]...

View 1 Replies

ActionScript 3.0 :: Protocol For Importing Classes From Sub Classes?

Feb 8, 2011

I'm trying to import a class from a class that is located in another folder. How do you move up a directory? Using./ or ../ doesn't seem to work. Essentially I want to access a TweenLite Class but not from the document class. My class is at com/myName and the class I want to access is at com/TweenLite. import ../TweenLite doesn't work... I realize I could just copy and paste the entire Tweenlite folder again, but there's got to be a less duplicative way of doing this..

View 2 Replies

ActionScript 3.0 :: Inheritance And Building Classes From Other Classes?

Feb 4, 2009

inheritance and building classes from other classes.

I have 3 classes:
gfxRoomText - changeable colour
gfxRomInter - changeable colour - interactive
gfxRoomImg - interactive - only image / no colour

The first two incorporate the same text field and functions to change colour. The second and third incorporate another class to interactive with. What is the best way of creating these classes using inheritance and how?

View 8 Replies

ActionScript 2.0 :: Editor - Enumerate The Elements Of Classes After Pressing "." Like Flash's Built In Classes?

Dec 21, 2005

I have to use many custom classes for a project, each class includes lots of elements(methods,properties) and I generally forget their names when coding. Is there any editor which I can enumarate the elements of my classes after pressing "." like Flash's built in classes?

View 8 Replies

ActionScript 3.0 :: Passing Classes Through Other Classes?

Nov 30, 2009

how to pass one class that holds all my math for a betting game though all my other classes that hold the pages.

View 2 Replies

ActionScript 3.0 :: How To Assign Classes And Sub Classes

Sep 15, 2011

I am new to classes and I am just starting to follow tutorials on how to assign classes and sub classes and I am wondering when you assign a base class or class to an object(Symbol e.g movieclip) through the properties, are all instances on the stage no matter how many and what they are named influenced and is the Stage/main timeline always the parent? and just one more question, is the parents objects display list all the movieclips that are used on the stage or all the instances on the stage?

View 6 Replies

ActionScript 2.0 :: Importing Classes In To AS3 Classes?

Oct 18, 2006

I am not sure how to import multiple classes into an AS3 class. Also I am bit confused on how "package" works now.[code]

View 2 Replies

Communication Between Swf?

Dec 3, 2009

I have a communication problem between to SWF. Here is my code, SwfA is the caller :Shared interface between the 2 Swf :public interface ItfA {  // some code} In the second Swf, SwfB, the document class :
 
public class MainB extends MovieClip {  private var a:Itfa;  public function start(_a:ItfA) {    a = _a;    // etc  }} 
 
In the first Swf, SwfA:
 
public A implements ItfA {  var mLoader:Loader;  [...]   public function startLoad()  {    mLoader = new Loader();    var mRequest:URLRequest = new URLRequest("B.swf");    mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,  onCompleteHandler);    mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onprogressHandler);    mLoader.load(mRequest);  }  public function

[code]....

When I test in the fash environment (ctrl + enter), there is no problem, but in my browser it failes and says that A is not an ItfA (TypeError: Error #1034)

View 1 Replies

Actionscript 3 :: Class - Reading All Classes Under A Package Or Reading Classes With Same Metadata

Jun 19, 2011

I am doing an Actionscript 3.0 project which involves introspection. I am wondering if there is a way to get all the classes within a given package structure.

[Code]....

View 3 Replies

ActionScript 3.0 :: Swf To Swf Communication?

Aug 21, 2008

I have two swf files. And i want to send data from one swf to another. So how can i do that?

I have 4 tabs in one swf file and when i click tabs then it should send data respectively to second swf file.

View 8 Replies

ActionScript 3.0 :: Communication Between 2 Swf?

May 15, 2011

I am using localconnection to communicate between 2 standalone swf. It works. I want to communicate between standalone swf and from browser/ from exe. Currently i cannot achieve this. How can achieve this?

View 7 Replies

Flash - Communication Between As2 And As3

Mar 16, 2010

I have this code under a button in 'as2.swf'

[code]...

and this swf is being loaded into as3 container called 'main.swf', but when i press it nothing happens and the file does not unload itself.

View 1 Replies

Asp.net :: Asp Communication With Flex?

Oct 26, 2010

i was developed one .net application. It contains flash animation in one of the asp pages. And i need to write action script code for playing and pausing that swf file. I am using flex builder3. However how can i execute the asp application from flex builder? How can i load asp page into mxml file?

View 1 Replies

ActionScript 2.0 :: Communication Between Pop Ups?

Jan 27, 2009

Im develp. a site with a remote control, and television pop ups, can i use the remote to communicate with the tv? I think i may have a proper (yet typically teedious) method but in these situations,

[URL]

View 3 Replies

ActionScript 3.0 :: Communication Between An SWF And C#?

Nov 10, 2010

I'm using Visual C# 2010, and I want to add an SWF-file to a C#-form. Then, I want the C# code and AS3 code to communicate.

View 3 Replies

ActionScript 3.0 :: 2 Way Communication With Php?

Jun 3, 2011

I have read a few things on 2 way communication for as3 to php but most of the examples are a bunch of var's being sent. an example of AS3 sending 1 var out to php and php receiving it. how to go from PHP to as3 just not the other way!

View 4 Replies

IDE :: Portlet And Swf Communication

Oct 6, 2009

i am creating portlet project and one of my portlets has embedded swf file in it.so i foud out how to send datas from portlet to swf,now i need to know how to do it in backward direction i.e. to send data from swf to portlet

View 1 Replies

IDE :: Swf Communication Within Same Html

Oct 7, 2009

I am having one html including table in it.In one cell of table i have 1.swf & in another cell in table have 2.swf.Is there any way to have communication between these two swfs? Like in 1.swf - have one play button with on clicking will play animation from secong swf.

View 1 Replies

ActionScript 3.0 :: Enlighment Between Communication Between SWF

Jun 9, 2010

i want to ask someone to give me some enlighment between communication between SWF..,let say i have one main swf (parentSWF) which load another swf (let's call it loadedSWF)what i want to do is calling parentSWF calling function which is remain in the loadedSWF..,please do mind i am talking about desktop application and not browserapplication..,

View 2 Replies

Data Integration :: Swf And Xml Communication

Aug 27, 2007

I want a swf to load var into an xml file so that when the swf re-opens it can look in the xml file to see where it last stopped playing.

View 2 Replies







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