ActionScript 3.0 :: Using EventDispatcher To Access Maintime Line

Jul 30, 2009

On a recent discussion I had a problem accessing a function on my main timeline from an external SWF. Muzak gave me the answer using eventDispatcher from que external SWF. Ok everything works fine. But when I test my website on my localhost embedding my SWF using swfobject it stops working.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Sending A Value From A Class Back To The Maintime Line & Calling A Method

Sep 22, 2009

I'm now finding the great need for classes as my current project is getting quite gummed up with too much scripting in the main document. Becoming a real pain to find stuff with in my code.

So I started writing a class to takes an id passed to it from the main time line, accesses my mySql DB, pulls the related info and the processes it. What I can't seem to figure out, is how to pass a variable back to the main time line. The traces all work, so I know my class works. I've searched here and via google, but I must not be searching the right stuff because I get a lot of results with are usually very complicated questions that don't yield the answers I need.

so here we go. my main.fla (and question):

Code:
import Name;
var theUserName:String = "Joe";
var processName:Name = new Name(theUserName);

[Code]....

ps: what's it called when trying to call a method from the main time line? or passing a property back to the main? are there specific terms for these?

View 10 Replies

Actionscript 3 :: Accesing Function On The Maintime Line From A Extended Movieclip Class?

Feb 21, 2010

I have some movieclips on my main timeline with a class to extend these movieclips

[code]...

But the I can't 'reach' the testing function. I get this error: "1061: Call to a possibly undefined method testing through a reference with static type flash.display:DisplayObjectContainer."

View 1 Replies

ActionScript 3.0 :: Line 10&11: Access Of Undefined Property Connection

Dec 12, 2009

this is the code that i wrote

var connction:NetConnection = new NetConnection ();
var stream:NetStream;
var video:Video = new Video(339,191);

[code]...

and this is the error that it said:

line 10&11: Access of undefined property connection

View 2 Replies

ActionScript 3.0 :: Access Main Time Line From Class?

Feb 12, 2009

document class

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

[Code].....

the highlighted function is what i need to be working but it isnt.. have no idea whats going on... i basically need to jump between frames on the root timeline (superMain)

View 1 Replies

ActionScript 3.0 :: Access A Var From The Main Time Line In To A Movieclip?

May 19, 2009

I'm making a quiz-type animation, since I'm new with ActionScript I had developed my own way to make this work. I want to add like a meter that shows one out three position depending on the answer given, I had made this animation as a movieclip but now I need it to react according to the answer, so it changes on every question to do that I need to access the variables I'm using in the main time line, how can I access the the main time line variables from the movie clip? The movie clip (meter) is basically the background and the questions will change and advance on top of that movie clip so it'll change with each answer until you get the final result.

View 12 Replies

ActionScript 3.0 :: Class Access A Variable On A MovieClip's Time Line?

Oct 2, 2009

in my class I declare a linked movie clip:

a_mc = new LinkedMC ();
trace(a_mc.testString);

and on the time line of LinkedMC: var testString = "test string"; but I can't access testString.

View 3 Replies

Actionscript 3 :: Access The Document Class' Properties From The Time Line?

Feb 28, 2010

I am building your standard slideshow flash header for a web page.

There are three main parts:

The Slideshow class A controller class that is used as the projects Document Class Some linking timeline code.

The slideshow class has all the functionality, so I used the Document class to create a new instance of the slideshow and keep a property variable called slideshow that keeps a reference the Slideshow instance.

import flash.display.MovieClip;
import flash.events.Event;
public class Header extends MovieClip
{

[Code].....

Despite me being able to call regular methods that are in the Doc Class from the timeline, I can not call properties without the following error, for example when i say slideshow.play():

1061: Call to a possibly undefined method play through a reference with static type com.example.test:Slideshow.

I have to make a method on my document class every time I want to wire an event to call an object in my Document Class?

View 1 Replies

ActionScript 2.0 :: Code In Flash To Read It Line By Line But Its Only Showing The First Line Out Of 5 Lines?

Dec 17, 2009

i have an xml file and i want my code in flash to read it line by line but its only showing the first line out of 5 lines.Below is the code:

var NigeriaNumber:Number;
var stateName:String;
var year:String;

[code].....

View 0 Replies

ActionScript 3.0 :: Root Timeline - Access The Main Time Line To Send It Over To The Page Services?

Nov 3, 2011

I have a label on my root timeline called "services". I have a services button inside a movie clip. How do I access the main time line to send it over to the page services? I'm using actionscript 3. Back in the day it would have been as simple as root.gotoandplay("services")

View 5 Replies

Actionscript 3 :: EventDispatcher Between An As And A Fla?

Mar 25, 2010

I am making a fighting game in Flash and while I have everything running, I am missing something: a victory/loss screen.Logically,I know how to do it:

if character.hp < 0
{
character.dead = true;
dispatchevent("death", event)
}

My problem is that I have no idea as to how to code it. I know I will use two classes and my two .fla files (unless I am wrong).I have two .fla files that are in play here: the Menu.fla file and the Arena.fla file. Menu.fla contains the entire navigation of the game, options, character selection screens, etc. and when it is time for the player to engage in battle, it loads the Arena.fla file, which contains only the backgrounds (depending on the selected stage) and for now is set to a length of one frame only. For Arena.fla, the real action happens in my classes, but logically, I would only need HP.as and Character.as.

In Character.as, I have declared the following variable:

var isDead:Boolean = false; //is character dead?

In HP.as, believe I should have the following:

if(currentHp<0)
{
currentHp = 0;
character.isDead = true; //declared as var `character:Object;`
EventDispatcher.dispatchEventListener("playerDead", playerDead);
}

And finally, in Arena.fla, I want to be able to detect the above-mentioned eventlistener and simply move on to a second frame which will display a message in the style of "PLAYER ONE HAS WON" or "PLAYER ONE HAS LOST" with a button that will allow me to go back to the character selection screen. This is the first part in which I am stuck: how do I detect the dispatched event listener in my main .fla file?

Secondly, if the player clicks on the "CONTINUE" button, which displays regardless if the player has won or lost, how can my Menu.fla (which loads the Arena.swf) detect this click event, unload the game, and go back to the character selection screen?

View 2 Replies

ActionScript 3.0 :: Way To Add Eventdispatcher

Aug 24, 2011

I have several classes with some eventListeners in my project that interfer with each other. I.e. i have a mouseclick event that is not triggered, when i have another class with init events running at the same time. when i remove that other class, the mouseclick event is triggered correctly.

now i am not 100% sure, but i think the solution to this has something to do with EventDispatcher.can anybody please tell me if that is correct and how i can add EventDispatcher to my code without recoding everything?

View 6 Replies

ActionScript 2.0 :: 2 Re-R&D Mx.events.EventDispatcher?

Feb 10, 2012

For some while I am researching on dispatching Events on AS2 which can bubble as it happens in AS3. This is not the first time in this world and I hope you all know how to do it in AS2. My issue is not on addEventListener but the removeEventListener which is not removing that particular event from that object.Cause the handler argument in the mx.events.EventDispatcher is throwing undefined where that should be [type Function]. At the time of registering on addEventListener it is registering the handler as [type Function], but it throw undefined on removeEventListener method.

[Code]...

View 4 Replies

ActionScript 3.0 :: Using The EventDispatcher Class?

Nov 6, 2009

I am trying to dispatch an event from one class to be received by another another class.The second class has a function that shoud trigger when the event is caught.When I compile I get this error:1067: Implicit coercion of a value of type flash.events:MouseEvent to an unrelated type String.

Here is the class that dispatches the event:
package{  import flash.display.MovieClip;  import flash.events.MouseEvent;  import flash.events.Event;  import

[code].....

View 2 Replies

ActionScript 3.0 :: Unable To Use The EventDispatcher

Jul 12, 2010

I'm working on a an interactive map of the Lewis and Clark Expeditons' experiences along the Missouri River in Montana and I'm running into some difficulty using the EventDispatcher class.

I have a couple of classes that I am working through this issue with. Relevant code is bolded.The first is a Main class that I am using as my Document Class:

[code]....

View 2 Replies

Flex :: When To Extends EventDispatcher?

Aug 8, 2010

I was wondering when you guys extends EventDispatcher in your class. It seems to me that as long as we have import event package, we can dispatchEvent without problems....I saw sometime people extends EventDispatcher in their clas

View 1 Replies

ActionScript 3.0 :: Regarding The Capabilities Of The EventDispatcher?

Sep 21, 2010

I have a question regarding the capabilities of the EventDispatcher. Is it possible for flash to dispatch an even and be able to push out information like an int or string?

View 2 Replies

ActionScript 3.0 :: Custom EventDispatcher Between Fla And As

Nov 6, 2010

How to dispatch events from a class (.as) to a document (.fla) ? In my example there's no compiling error but nothing displayed by trace(). What's wrong and how to do to make it works? example.fla

[Code]...

View 8 Replies

ActionScript 3.0 :: EventDispatcher And AddEventListener?

Dec 17, 2010

I just don't get it. I've studied a lot, looked, researched but I don't understand why this isn't working.

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

[Code]...

View 4 Replies

ActionScript 2.0 :: EventDispatcher And XML Events?

Jan 16, 2006

These days I'm learning the different usages of EventDispatcher class and understanding it's working.

[code]...

Considering the above code if for example I want to broadcast the event of onLoad of xml to different listeners objects with the scope of movieClip in which the xml object is declared, so that later mcs from the library can be attached dynamically.However this approach does not seem to work.

View 4 Replies

ActionScript 2.0 :: EventDispatcher - Getting Rid Of Events

Jun 15, 2006

Theory question, more than anything.
Code:
var page = _root["pageinstance"+num]; //num is a variable,
page_li:Object = new Object(); // page_listener object
page_li.onPageLoad = function() {
trace("hey, look, the page loaded");
page.display();
[Code] .....

The code is much more complex than this, but thats the skeleton of it. Anyone, my question to you is that I need to use this over and over again, for each time the user presses a button. My problem is that Flash seems to have trouble when I try visiting a page I've already been to, because the events don't properly execute. I've tried page.removeEventListener(); and delete page_li; but both seem to be ineffective. Basically, how can I whip the slate completely clean, so that the next time when Flash goes over this code, it executes properly?

View 2 Replies

ActionScript 2.0 :: How To Write An Eventdispatcher

Apr 1, 2007

How to write as2.0 using class to respond a simple event handler for several mc's?[code]does anyone have some good examples of using eventDispatcher method in a class?

View 1 Replies

ActionScript 3.0 :: DispatchEvent Without Extending EventDispatcher?

Jan 27, 2010

How should I dispatch Events in my objects without having to extend the EventDispatcher?

View 6 Replies

ActionScript 2.0 :: Watch Variables With EventDispatcher?

Feb 14, 2007

I would like to know if there is a way to watch / listen to variables or object properties using the eventDispatcher class ? I checked tutorials about this class and I understand basics but I really don't see how to do this..

I know the existence of the watch() function, but I heard its possible to use eventDispatcher instead...

View 12 Replies

ActionScript 3.0 :: [Flash Cs4] EventDispatcher Class?

Jun 20, 2009

i have a class called "RandomErrorClass" that extends Error:


Code:
public class RandomErrorClass extends Error {
public function RandomErrorClass() {
super("random error...");[code]....

my understanding is that the second class, the one that throws the error, will have to extend the EventDispatcher class. is that right? but it already has to extend the MovieClip class. my questions: Does the movieClip class already inherit from the EventDispatcher class? if so, i won't have to implement the IEventDispatcher interface, will I?

View 2 Replies

ActionScript 3.0 :: EventDispatcher And Inaccessible Variables?

Dec 10, 2010

I'll try to explain my problem as simple as possible So, I have class A (main class) and class B, and I need these to communicate with each other.

[Code]...

This gives me the error: Access of undefined property RNDMCOLOR... but, I made it public, so it should be accessible by other classes right? Apparently, no I have also tried to type the string "rndmColor" directly into the eventDispatcher and listener, and that gets rid of the error, but the chooseColor function is never called. So what the heck am I doing wrong? How do I make variables accessible from other classes if public doesn't do it?

View 2 Replies

Flex :: Listen To All Event Types Of An EventDispatcher?

Oct 6, 2010

In Flex, is it possible to listen to all event types of an object that's an IEventDispatcher? addEventListener's first parameter is the type, which is a string. In many cases the documentation is not clear what event type it fires. I'd like to attach a generic listener to inspect the events.

View 2 Replies

ActionScript 3.0 :: Dispatch An Event With Extending EventDispatcher?

Feb 3, 2010

I need to send a signal from my class BasicVideo.as, to my main class Main.as.

BasicVideo.as extends (and needs to extend) Sprite.

So, how can I dispatch an event from that class to the main class without extending EventDispatcher?

View 1 Replies

ActionScript 2.0 :: EventDispatcher Tutorial By Jesse Marangon

Feb 10, 2009

I'm reading Jesse Marangon's EventDispatcher tutorial. Most of it makes sense. However, when I copy the code into Flash I get a return of objEvent. count = undefined.It looks like the external class Interval is being properly found/used as the rest of the function works.

View 2 Replies

ActionScript 3.0 :: List All Current Listeners To An EventDispatcher?

Aug 13, 2009

Is there any way to list all listeners to an EventDispatcher instance, or at least list all event strings that are being listened for?

I know there is a "hasEventListener()" function, but you need to know the string you pass in in order to check for it. I suppose it would be bad coding ethic, but it can have its uses. (Am I making myself clear enough on what I am looking for?)

Also, how are eventListeners speedwise? Since there is a lot that needs to be accomplished when dispatching and listening for events, would it be a bad idea to use an Event system for such potentially CPU heavy items as collision detecting?

View 1 Replies







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