ActionScript 3.0 :: Transferring Values From One Class To Another Via DispatchEvent?

Nov 9, 2009

transferring values from one class to another via dispatchEvent.

main.fla
code/main.as (Doc class)
code/game/card.as
code/game/board.as

I can communicate an event between any of them fine using a dispatchEvent and addEventListener, and I can get values from the card & board actionscript files into main.as using e.target.*

However for some reason I just cannot get a value to send from main.as to the card or board classes using this same method. And I'm literally stumped as to why.

View 6 Replies


Similar Posts:


ActionScript 3.0 :: Flash: Transferring Loaded Object From One Class To Another

Feb 27, 2010

I'm using flashDevelop for an avatar creation engine. I have a movieclip(class) called body_view which is structures like this : body_view -> 10 visual body components -> each component needs to have a jpeg loaded Then there is a body_model class which is extended from the body_view class and is responsible for all loads/saves/interactions now body_model class is as follows: body_models -> variables holding (values) -> populateView (function)

Now through the populateView function I need to populate the components of body_view but the issue is if I load a jpeg/swf on a function it comes on stage. I do not want it on stage I want it in its perticular place in the body_view

View 3 Replies

Actionscript 3 :: Flash: Transferring Loaded Object From One Class To Another?

Feb 27, 2010

I'm using flashDevelop for an avatar creation engine. I have a movieclip(class) called body_view which is structures like this :

body_view -> 10 visual body components -> each component needs to have a jpeg loaded

Then there is a body_model class which is extended from the body_view class and is responsible for all loads/saves/interactions now body_model class is as follows:

body_models -> variables holding (values) -> populateView (function)

Now through the populateView function I need to populate the components of body_view but the issue is if I load a jpeg/swf on a function it comes on stage. I do not want it on stage I want it in its perticular place in the body_view

View 2 Replies

Flash :: DispatchEvent In Static Class - AS3

Jan 6, 2012

I can't use dispatchEvent in my static class, I was wondering if anyone knew how I can achieve similar functionality or if it's possible at all to call dispatchEvent from my static class? I basically want to inform my action script code in my flash file when functionality in my static class is complete.

View 4 Replies

ActionScript 3 :: DispatchEvent Does Not Work In Secondary Class

Jan 14, 2011

I have a SWF called Application.swf that loads another SWF called jeu.swf. My main class (don't know how to call it haha), is called Main.as. Another class is called actionObjets.as. When I call:
dispatchEvent(new MicroJeuEvent(MicroJeuEvent.JEU_TERMINE, 8, ""));
It works perfectly from Main.as, it works perfectly.

But when I call it from actionObjets, it doesn't work. No error either. I tried putting this line in a static function, doesn't work either. Why can I dispatch an Event from my main class and not from another one? I'm not a programmer and I just don't get a few of the basic principles of as3. Is there a way of doing differently?

View 1 Replies

ActionScript 2.0 :: DispatchEvent With A Function Declared Inside The Class?

Jan 19, 2007

I've got a class where I'm using:

o.type = "focus";
o.target = "this";
dispatchEvent(o);

and then focus is a function of an object in the FLA.

I want focus to be in the AS External Class file but it won't trigger.

View 3 Replies

ActionScript 3.0 :: DispatchEvent - Create A Listener In My Main Document Class?

Jan 13, 2009

I'm trying to dispatch a custom event. So that my main document class can react when a nav button is clicked.I have a navbutton class which creates the dispatch's the event... and is handled by the onNavigate Method...

private function onClick(evt:MouseEvent):void {
//trace(_label.text + ": path = " + _projectNode.@path);
//trace(evt.target._label.text);[code]....

This onNavigate method works perfectly.... however when I try to create a listener in my main document class I don't "hear" the event.Here's part of the code from the main doc class...here's where I register the listener

this.addEventListener("NAVIGATE", doSomething);

here's where I should handle it...

private function doSomething(e:Event) {
trace(e.target.name);
trace(e.target._label.text);

View 12 Replies

ActionScript 3.0 :: Get The Instance Of The Class To Call The DispatchEvent For The PostTrace Function

Feb 8, 2009

How can I get the instance of the class to call the dispatchEvent for the postTrace function.

1180: Call to a possibly undefined method dispatchEvent.

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

[Code].....

View 1 Replies

ActionScript 3.0 :: DispatchEvent Versus A "State" Class?

Sep 17, 2010

Like most Flex/Flash Builder developers, I have been using the dispatchEvent method to communicate between different classes of an application. And, that works fine, but, I have been toying with a different idea about inter-class communications and would like you to shoot it down, if you can.

Why not have an application "state" class, instantiated as a singleton, which holds the information that is needed by the application's various classes? Examples would be current user and session, currentState of the parent application, selection criteria, data providers, etc. Each class would, of course, have to be aware of this state class. Each class in the application would post its relevant state to this "state" class, and likewise each class could establish listeners for changes to the relevant objects therein.

It just seems to me that, rather than dispatching events, setting up listeners that in turn fire off a listener method, I could instead bind, for example, a datagrid to the state class' relevant data provider, or whatever is needed. In other words, all "listening" and binding is performed against a single state class.

View 9 Replies

ActionScript 3.0 :: Changing Variable Values In One Class From Another Class?

Sep 7, 2010

I have two document classes. One is Main.as the other is Step2.as. I want to declare a public variable in Main.as then need to give it a value from Step2.as. That value will later be used in my next Document class Step3.as How would I write the code that gives the value in my Step2.as and then how would I write the code that retrieves the value in my Step3.as?

Note I can't import my Step2/ or Step3 document class into my Main.as.

View 2 Replies

Professional :: Transferring CS5.5 To CS5?

May 25, 2011

I started this school project on a CS5.5 but my school only has CS5 not CS5.5 and i'm trying to transfer my files on CS5.5 to CS5. Is there any way to do that or is it just a lost cause?

View 4 Replies

ActionScript 3.0 :: Transferring Data From One SWF To Another

Nov 15, 2010

How I should go about coming up with a program in action script 3 that can transfer data keyed in one swf file to another. Basically all I want is to key in a name in the 'y.swf' file when it plays in the browser, and when I click on submit another swf (z.swf)opens in the browser saying 'You keyed in '***'. The value keyed in the 'y.swf' file should be tranfered and stored as a variable in 'z.swf'.

View 3 Replies

IDE :: Transferring Xml Data To Swf Across Domains?

Jun 21, 2009

I just recently created a news ticker using the tutorial on Kirupa; however, I have not been successful at getting my xml data to show up on the news ticker. I have my xml file stored on and my website will be stored on Savannah State University's server. I do not want to have my xml file on the same domain as my website because it will be on my school's server and they don't allow access to their server. I want to be able to update the news ticker freely.

View 5 Replies

Professional :: Transferring Color Variable Changes Its Value

Nov 23, 2010

I have two variables:
var defaultMainHexidec:Number = 0xFFFFFF;
var mainHexidec:Number;

If a value isn't assigned to mainHexidec I assign the default value as follows:
mainHexidec = defaultMainHexidec;
trace("mainHexidec = " + mainHexidec);

The trace returns the same value as the value returned when tracing the defualt value. But if I use mainHexidec as the fill for a rectangle, the color is black while the default value is white (or any other color). If I set the color using the default variable the fill appears correctly. If I set the number using the number traced in either defaultMainHexidec or mainHexidec (it traces the same number) the color is correct.

View 5 Replies

Actionscript 3 :: Transferring A JPG Between Two Flash Files?

Nov 25, 2010

I haven't started work in this yet, however I intend to and would like to know the best method.There will be two screens,each powered by a separate machine.I want to be able to move the image off one screen and it appear on the other (machine 2).The image will be captured from a webcam on machine 1.The first idea I had was convert the image to a string, pass the string to the flash file on machine two, decode and display.Is this possible, or is there built in function in flash or as3 that would would recommend, or even a different method?

View 2 Replies

ActionScript 3.0 :: Transferring Elements From One Vector To Another

Oct 6, 2009

I have function that's used to transfer elements from one vector to another. The problem is that I need to use this function to transfer data from multiple pairs of vector with each pair having a different data type. I tried this but it came up with an error.

ActionScript Code:
function addToVector(dataType:Class, vect:Vector.<dataType>,
baseVect:Vector.<dataType>):void {
for (var i:int = 0, l:int = vect.length; i < l; i++)
baseVect.push(vect[i]);
}

I've also tried this, but then flex says it doesn't recognize the vector class.
ActionScript Code:
function addToVector(vect:Vector.<*>, baseVect:Vector.<*>):void {
for (var i:int = 0, l:int = vect.length; i < l; i++)
baseVect.push(vect[i]);
}

This failed too
ActionScript Code:
function addToVector(vect:Vector.<Object>, baseVect:Vector.<Object>):void {
for (var i:int = 0, l:int = vect.length; i < l; i++)
baseVect.push(vect[i]);
}

View 2 Replies

ActionScript 3.0 :: URLLoader Keeps Transferring Data

Sep 14, 2010

All Im trying to do is post firstname, lastname and emailaddress from a form inside my swf to a php file and then get that php file to return a result back to my swf.

First of all i tried using external interface to handle this because the server its going to run on doesnt support PHP.

I had the SWFgrab the data from the text fields, pass the data to JS through external interface, then the JS would use jquery AJAX to execute the php file, then the JS would grab the results from the AJAXd div, then pass the data back through to the SWF. It was a bit of a circle jerk but it worked.

However, the PHP script that needs to be executed in a different domain as the SWF. I forgot that this would cause an issue. I then tried to setup AJAX crossdomain policies, but this is going to be a reasonably high traffic site and i felt that the proxy options that i found were kind of slow.

I realised that what id been doing so far was probably over complicated anyway. So, i went back to basics and thought id try using the URLLoader to load in the php file as a string. I setup a crossdomain.xml file on my server that will be hosting the PHP and used the loader to grab the PHP file.

This works fine, all the PHP does is echo out 3 comma separated values which i then split into an array and use in my SWF. I get the values no problem. However, my status bar in firefox keeps saying that its still transferring.

Ive tried telling the PHP script to 'exit();' after its echo'd out my results. Ive tried telling the URLoader to .close(); when its grabbed the data, neither of which stop it from transferring. Im also using the web debugging proxy 'Charles' and that says that the connection opened and closed successfully, but firefox still says that its transferring.[code]...

View 3 Replies

ActionScript 2.0 :: Transferring One Flash File To Another?

Aug 3, 2010

I have baiccly made a dress up game , but i have kinda of done it backwards and i have made the 2nd scene the 1st one

The boy side of the dress up game wasin the 1st scene and i have made the intro screen the 2nd one so you can chooseif you want to dress the girl or the boy. the only thing is that the girl dress up is in a completely diffrent flash file/project. I thought of the intro screen at the last min, was just going to have to seprate games girl and boy.

Buti would like to transfere the girl one to the boy one, so i can do my as for my girl button, but i dont know how to do that as well as keeping all my as in all my converted symblos and everything

View 1 Replies

ActionScript 2.0 :: Transferring Data From One Page To Another?

Sep 27, 2002

I have 2 radio Buttons in a group called train1.

I am trying to carry the label of the selected radio button to a dynamic text field on another page(frame).

I have tried this

function onClick(btn) {
if (btn == submit_btn) {
getResults();

[Code].....

View 1 Replies

Actionscript 3 :: Transferring Flash Project From Mac To Windows

Dec 9, 2010

I have a .fla on my Mac that I created in Flash cs5. I saved it as a cs4 file and sent it to a friend who has a Windows machine.

I have a symbol linked to an AS class which has symbols inside of it which have instance names. The constructor of the class refers to these instance names. When I compile, everything works as expected. When my friend compiles, he gets compiler errors telling him that the instances mentioned above are undefined.

Checked to make sure that we had the same source path Made sure that the symbol in the Flash IDE has the correct linkage Tried compiling the .fla with cs4 on my machine. It works, which is what makes me think it's a Mac/Windows issue.

View 1 Replies

ActionScript 3.0 :: Access Values Held By A Class Instance From Another Class Instance?

Oct 14, 2009

I have to admit I pretty much ran away from Flash when AS2 came along and only used it for animation purposes over the last 5 years.So I'm having a major crash course in AS3 in Flash CS3 and I'm not enjoying it one bit. I'm getting maybe 10mins of finished work per hour as I try to figure out the limits and rules of AS3. Quite often it seems that AS3 simply can't do what I want it to. Anyway: Characterchecks.as is the main class and it loads a bunch of XML into four arrays. The file starts like this:[code]If I trace the value of, say, cc._Categories from the main FLA, it's empty. I'm guessing that the next line of AS in the main FLA doesn't wait for the previously called function to complete? (This may tie in to my next problem)My next step is that I want to display various things based on the data in the array. I have another class, Display.as which will hold all the functions to create the items on display. I thought it would be best for these to be a separate object. I wonder if I'm right?

So I declare an instance of Characterchecks in the main FLA and call it cc, and then run the functions to populate the arrays... Now I create an instance of Display and call it cd. How can I get functions in cd to see the values of the variables in cc? And if the main timeline can't tell that the functions aren't finished filling the arrays, how is cd supposed to know?I might be asking dumb questions, or maybe I'm doing things ***-backwards, I don't know. I'd appreciate any help, I really would. This whole thing has me at the end of my tether... being the most technically advanced person in my circle of co-workers and web design friends means I have no-one to explain why things need to be done a certain way or what the best way is.

View 3 Replies

Banner Ads - ClickTag And Transferring Variables In Query String

May 4, 2010

Is there a standard way to send variables through a banner ad? A client wants a banner that lets the user enter his mobile number, then receives a code by sms, and then enters the code into the banner. If the code then validates, the user is sent to a page with a login form with the phone number and code filled in. It must be possible to add the phone number and code as parameters to the clickTag somehow? I found that Adform supports using ";cppar=1&" and then variable=value pairs, but is this a standard, or a special feature of Adform?

View 1 Replies

ActionScript 2.0 :: Transferring Data From Domain At Bottom Of Browser?

Jan 16, 2009

I am using the loadVariable method of the MovieClip class to load some data. I have a question about the "transfering data from domain" message I see at the bottom of firefox for a page that has this swf loaded in. The load variables call obviously complete very quickly (the output is just h=1&d=1, or something as short as that) but the transfering data remains the entire time the page is in the browser (like half an hour later, etc).

View 1 Replies

Actionscript 3.0 :: Zend AMF Call Isn't Transferring To Client Server

May 7, 2010

I have a client that I am going live with so I am transferring their website from my web server to their web server. Using Zend AMF, I am calling a database that reads perfectly when I point to it from my server but it doesn't work when I call the database from the client's server. In both instances, I am pointing to the same absolute path to my boot strap (on my web server). I don't understand what the difference would be.

View 2 Replies

Flash :: Wave Of Values Class?

Apr 19, 2011

The problem with Math.sin() is that I cant figure out a way to control the increment. Still this seems like a lot of code for such a simple concept.

[Code]...

View 2 Replies

ActionScript 3.0 :: Passing Values To Another Class?

Feb 8, 2011

Passing Values From One Class To Another.

This this not seems a difficult tusk to understand.

I can able to connect classes to each other. But the thing is that, when I am going to construct some logic to load and hold xml data and only fetch the correct child object from it, I stumped.

Here is the starter:

I connect loadXML.as to Main.fla from Properties Panel.

loadXML.as
ActionScript Code:
package {
import flash.display.Sprite;

[Code].....

View 5 Replies

ActionScript 3.0 :: Class Instances And Null Values?

Sep 22, 2008

I'm currently stumped by this. I've created a class to load xml data from a txt file, then assign that xml to a variable named siteStructureXml. When I trace the value of siteStructureXml from within the class instance it shows the expected xml data. When I try to assign the value to a variable returnedXml defined on the timeline of my movie, it's value traces as null. I've a feeling it's something blindingly obvious..

[Code]...

View 3 Replies

Pass Instance Of Whole Class / Just Specific Values?

Jul 12, 2011

I am wondering if it's better to pass an instance of a whole class to another class or just specific properties of that class. For example if I want the height property of class A in class B do I pass just the height value into class B or the whole instance of the class and use classA.height in class B?

View 3 Replies

ActionScript 2.0 :: Limit On Values When Using Tween Class?

Nov 12, 2009

I'm wondering if there are numerical limits for the values you can manipulate using the tween class.I am importing mx transitions and using them to manipulate the _xscale and _yscale of a movie clip.. If I understand correct.. x and y scale property is measured in percentage.is there a limitation on the value I can plug in? Can I scale.. say.... 1,000,000% (million)how about 100,000,000,000 !!! (one hundred trillion)How about limits on _x and _y position values..?to quell any curiosity, I'm essentially trying to control a movie clip that has the appearance of 'zooming' in with button clicks by increasing the scale..

View 13 Replies

ActionScript 3.0 :: Retrieving Class Values In Main Timeline?

Feb 28, 2012

The code works, I'm jsut unable to read the Class variable "myString" on the main timeline.I thought I could pass the "myString" value from the Class to the Main Timeline?I created a variable in an external Class .as file.See coding below.

//------- Code on main timeline .Fla
var testClass:MyClass = new MyClass(myString);
var myString:String;

[code].....

View 3 Replies







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