ActionScript 3.0 :: Communicating Between Linked Classes?

Oct 28, 2009

I have been struggling with what seems to be simple concept in ActionScript 3.0 - how to communicate between classes. I have a very simple experiment with two movieclips on the stage. They are named YellowBox and RedBox in my library. I have linked the following code to the YellowBox movieclip: 
 
package{    import flash.display.MovieClip;    import flash.events.MouseEvent;        public class YellowBox extends MovieClip    {                public function YellowBox()        {            this.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);        }                public function rollOverHandler(event:MouseEvent):void        {            this.x = x + 3;        }    }}
  
What I would like to do is call the YellowBox() function on my RedBox MovieClip with the following code:
 
package{    import flash.display.MovieClip;    import flash.events.MouseEvent;        public class RedBox extends MovieClip    {                public function RedBox()        {            YellowBox();        }    }}
  
I get the following message when I compile: 1136: Incorrect number of arguments.  Expected 1.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Communicating Between Classes?

Jan 26, 2009

I'm trying to call a function from a class that I've instantiated on the main timeline from another class that I've also instantiated on the timeline.The function I'm trying to call adds a line to a string that acts as a game terminal so that even if the game glitches for someone without the source code, it would be possible to read the variable changes and functions called. (it also doubles up as an input for unlocking characters and levels that are otherwise hidden)Main Timeline:

Code:
import britland.Character;
import game.terminal;
var GameTerm=new Terminal();[code]....

I've tried both "flash.display.DisplayObject.stage" and "this.parent.parent" here after discovered that "_root" has been removed and "root" doesn't work in the same way.

View 6 Replies

ActionScript 3.0 :: Communicating With Other Custom Classes?

Sep 10, 2009

How do I let a custom classes know, what I've done at other classes,so that it would run an action accordingly?a function in the button classes:

ActionScript Code:
public function btnClick(event:MouseEvent):void {
var zoomF:theZoom = new theZoom();

[code].....

View 2 Replies

ActionScript 3.0 :: Flash Communicating Between Two Classes?

Apr 21, 2011

I have a custom keyboard class. The second class is having a textBox as its child and my custom keyboard's object as child. When the key in the custom keyboard is clicked, how can i update the value in the text box?

View 4 Replies

ActionScript 3.0 :: Communicating Between Parent And Child Classes?

Dec 23, 2009

Basically, I have a menu system for a website that is built on a three tier hierarchy. onclick event handlers load movieclips which contain the next submenu in my menu system. Each menu and sub menu is a series of movieclips with roll over, roll out and click eventlisteners applied to them to give them button characteristics.

However, I have hit an unforseen problem. I need to be able to control all the onclick event handlers assigned to all my buttons from one place, not in lots of different movieClips. I want to be able to add and remove different website content pages in one display object or else I fear that pages will start to appear to overlap as they are added within their specific sub menu movieclips.

I guess what I am trying to say is, can I control movieClip instances that are contained within a child object from my main timeline?

View 1 Replies

ActionScript 3.0 :: Communicating Between Classes - Dispatching Event?

May 30, 2010

I'm just starting to build my first proper OOP piece.I have on stage two manually placed MCs.One is viewer_mc:ViewerClass and one is menu_mc:MenuClass.They each have their own class and there is a document class...

PHP Code:

package
{
import flash.display.*;[code]....

So I can call the public method of either class from the other class.However, I am now trying to understand custom events and dispatching them with parameters.which uses a custom event class.This works fine when the dispatchevent and listener are both in the viewer class, but when the dispatchevent is in the viewer class, and the listener is in the menu class I can't get it to work.I suppose for my purposes I don't really need to use the custom event class, I can just call the respective classes' public functions but I just wanted to try and understand how it works.Here's the pared down version of menu class...

PHP Code:
package classes {
import flash.display.*;
//some other imports[code].........

View 4 Replies

ActionScript 3.0 :: Communicating Between Classes - Change Alpha For Image Using Button

Feb 25, 2009

I am having problem making classes to communicate. I have main class which loads external swf that contains one image at this time. I want to change alpha for that image using button (created from library) from main swf. Don't know how, various methods I tried gave various error messages.

View 5 Replies

ActionScript 3.0 :: Load SWF And Add Linked Classes To Stage

Jun 24, 2009

- I have a player.as with code to control playback of videos
- I have a skin.as with code to control and organise skin components
- The skin.as file loads a "shared library" (quotes as I don't think I'm doing this correctly) which is essentially a swf file with nothing on the stage. It's library contains things like: play buttons, scrub bars etc. all these assets have associated, linked class files to add functionality.

1. Load the containing swfs
2. Create new instances of the linked classes
3. Add them to the stage to be used.

However, there is an issue preventing me from using the linked assets in this way - I can't use the linked assets unless-
- I add something to the stage of the "shared library" swf
- I then do something like skinSwf.addChild(libraryFile)
What I want to do is just use the linked assets, not have to deal with any other parts of the "shared library" file.

View 4 Replies

ActionScript 3.0 :: Accessing Objects With Linked Classes?

Sep 15, 2010

So I have a menu built inside of Flash CS4 that has a graphic for a background and five text fields that sit on it for menu options. The whole thing is saved as a movie clip in the library. The text fields all have instance names like infoBtn and mapBtn etc. and the menu is already on the stage and linked to it's own class in the library. My problem is accessing those text fields on the menu from the class. I keep getting "Error #1009: Cannot access a property or method of a null object reference." and the menu doesn't work. But if I trace the infoBtn.text in the class it outputs the text that is in the text field. So the code is accessing it but it's still not working?

Code:
package classes
{
import flash.display.*;
import flash.events.*;

[cODE].....

View 0 Replies

ActionScript 3.0 :: Communicating Between Classes - TypeError: Error #1009: Cannot Access A Property Or Method Of A Null Object Reference

Oct 12, 2009

I have this error when I run the files.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.common::stageConfig()
at cloudsMain()
CloudsMain.as which is attached to the .fla

[code]....

Basically I'm trying to create a class that I can call and centralise any mc on stage by eg.stageConfig.centralisedDO(my_mc), However I encounter the above error.

View 2 Replies

Flash :: Flex - Manage Library Symbols With Linked Classes In CS4 To Compile / Debug In Builder 4?

Apr 2, 2010

I'm building a video player using Flash CS4 (hereby referred to as "Flash") to create the graphic symbols and compiling and debugging with Flash Builder 4 ("FB4"). Here are the steps I take in my current workflow: --Create the graphic symbols in Flash. I've created a few different symbols for the player, but I'll focus on just the play/pause button ("ppbutton") here. --In the Library panel, I go to the ppbutton symbol's Linkage properties and link to a class named assets.PlayPauseButtonAsset that extends MovieClip. I do not actually have an assets package nor do I have a class file for PlayPauseButtonAsset as Flash will create them for me when I publish.

--In Flash's Publish settings, I set the project to export a SWC that will be used in FB4, called VideoPlayerAssets.swc. --After the SWC is created, I create my FB4 project called "VideoPlayer" and add the SWC to my path. FB4 creates the class VideoPlayer in the default package automatically. --In VideoPlayer.as, I import assets.*, which imports all of the symbol classes I created in Flash and are available via VideoPlayerAssets.swc. I can now instantiate the ppbutton and add to the stage, like this:

[Code]...

View 2 Replies

Flash :: Find Out The Linked Url Of The Image And Where Is The Linked Url Code In?

Nov 29, 2011

How can find out the linked url of the image in the flash of a website? I looked for the image url some time. but couldn't find itif find the linked url of the image, and i want to alter an image linked url address. where is the code in?

View 3 Replies

Flex - Mxmlc With Both Linked And Not Linked Rsls?

Jul 27, 2009

On the mxmlc command line, I can include paths to RSL files. I can choose to link these RSLs at runtime by setting

-static-link-runtime-shared-libraries=false What if I need to link to some rsls and embed (static-link) other rsls? Is there a way to set the link settings for each rsl?

View 1 Replies

ActionScript 2.0 :: Communicating Between Two Swf's?

Jan 26, 2010

I have a Master.swf which loads in a game, lets call it A.swf. Once the game is finished, Master.swf then loads the home page, lets call it B.swf. I have this working.

I have a progress chart in my home page which tracks the user's progress in the game (like number of successful attempts, number of items collected etc etc). If a user completes the game, and the home page is loaded, then how do I get the newly updated info to display in the home page?

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 2.0 :: CS3 Communicating With Html

Apr 19, 2009

i have seen this done where a flash file knows what page it's on by some piece of code on the html page. It could have been php or java i don't know but i would like to know how to do that. That way i create one flash nav bar and it can tell what page it's on so i can make it so you can't click the page your on.Let say i have three pages Home, About us and Contact us and build a flash navigation for it. Some where in the HTML documents there is a code that tells flash what page it is. Flash reads this info and knows "oh i am on the Home page" or "i'm on the Contact us page" and will respond accordingly.

View 2 Replies

ActionScript 3.0 :: Communicating From External Swf

May 13, 2009

Im working on a project wherein I have the main fla tied to a document class entitled MyContent. The main fla consists of buttons and textfields, etc. External swfs are loaded when the buttons are pressed. My question is what code would I have to include in one of the external swfs to allow it to be able to change the content of one of the textfields, which was assigned dynamically in the MyContent class? The code within the MyContent class consists of a dynamic text field on the stage named longDesc and a string named long1. ex:

Code: longDesc.htmlText=long1; In the external swfs I have images that are enlarged on a click event and would like to be able to have the textfield in the MyContent classed changed as each image is selected through code in the external swf.

View 4 Replies

ActionScript 3.0 :: Communicating Between Swfs?

Jul 10, 2009

Okay so i heard it was possible but im not sure.

Example: i have 1 main swf containing everything. inside that swf i load 1.swf

can 1.swf share the same vars and everything as the main swf? such as.. if i click a button in 1.swf, then something will happen in my main movie.

View 3 Replies

ActionScript 1/2 :: Communicating With Php From Another Server?

Mar 12, 2009

I use loadVars to communicate with a .php file. When theflash files is on the same domain url, let'sthe .php file the communication between flash and php works. When Iput the flash file on another domain than the .php file (somethingcommunication process doesn't work anymore

View 3 Replies

ActionScript 3.0 :: Communicating To A Loaded .swf

Jun 9, 2009

I have finally figured out how to preload, and gotten my main movie to load an external swf properly. My last hang up, is how to speak to that loaded swf, with a button added above it in the main timeline.So, my button is Nextbtn (added via addChild), and my swf is titled "about_mov.swf", when it is loaded, it goes to frame 10 and stops, what I want to happen, is when you click the NextBtn, that loaded swf advances to frame 11. Just not sure how to reference it properly, and hping i can get a quick solution on it.

View 5 Replies

ActionScript 3.0 :: Communicating Between Loaded SWF's?

Jul 19, 2009

I have a flash container that loads other flash files that have been made in Adobe Captivate, (essentially just normal SWF files) and on top of that I have other SWF widget files that I have created as it's children to extend default Captivate functionality. So essentially i have 3 'levels' of loaded SWF's.Container -> Captivate SWF -> WidgetThe problem lies in the middle - I don't know how Captivate is arranging its variables, events and loaded children since I don't have access to it's code. What I want to do, is to get my container SWF communicating with the Widget one and vice versa, but I can't get the hiearchy working... I can send values to the "stage" via the widget, but not vice versa.

So firstly, since I don't have the SWF code -- Is there a way to list all variables inside a child or parent so I can work this out?- Is there a way I can tell when a child or parent is triggering an event? (especially when I don't know the names/functions of the event)- and is there any easier way I could be going about this that i'm not seeing?

View 5 Replies

Actionscript :: Communicating With A Loaded Swf In Another Swf

Nov 15, 2010

I have loaded an AS2 swf inside another AS2 swf using MovieClipLoader. I have no control(cannot edit) over the child swf. Is there a way I can communicate with the child swf from the parent swf. The child swf is not accepting any LocalConnection Objects. Can I call a method in the child swf some other way?

View 2 Replies

ActionScript 2.0 :: Communicating From XHTML To An SWF?

Jul 26, 2009

I can successfully call ajax-like functions from my Flash header to update my page. But how can I update the SWF with calls from my page. My page is XHTML. When a link is clicked, I would like the Flash header to move to a specific keyframe.

View 0 Replies

ActionScript 2.0 :: Communicating With PHP From Different Scenes?

Nov 30, 2009

I seem to be having issues with sendAndLoad() from different scenes.When I load the .swf (ctrl+enter) the communication is fine, when I naviget to scene2, the same code doesn't seem to execute at all...

Code:
//--------HERE WE SEND THE DATA--------//
var myLv:LoadVars = new LoadVars();

[code].....

View 1 Replies

ActionScript 3.0 :: Communicating Between Swfs Possible?

Jan 20, 2010

I want to communicate between a embeded swf and the main swf. I want my main swf to tell the embeded swf to do something like gotoandplay(3)Main.swf loads Sub.swf into a empty movie clip called imageArea._mc.Is it possible to have the main swf tell my sub to do something?[code]

View 1 Replies

ActionScript 3.0 :: Use Better When Communicating With Php Server?

Jun 7, 2010

I couldn't find out which protocol, whether JSON or XML, to use better when communicating with php server and actionscript 3. The data size sent out from server to as3 could be a bit big so I need to choose depending on which one works faster.

View 9 Replies

Actionscript 3.0 :: Communicating Across Timelines

May 8, 2009

I have added an attachment to this file. What I want to happen is, when I click 'blueBtn' I would like 'pic1' to fade to alpha:0 (using TweenMax)... It seems simple enough but I just cant get it to work.On the Greensock Forum someone gave me this bit of code without any real explanation, how do I put it to use?:[code]

View 8 Replies







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