ActionScript 3.0 :: Passing Value To Different Class

Nov 23, 2009

I have those 2 function inside a class named MenuScreen.as, What I want to do is send a value true or false to another class named Game.as.If the user clicked mouse icon the value must be true and if user clicked keyboard icon it must be false.[code]

View 11 Replies


Similar Posts:


ActionScript 3.0 :: Passing Variable From Document Class To Movie Clip Class?

Oct 12, 2010

i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!

ActionScript Code:
var main:Main=new Main();
main.txtScore.text="hello";

View 1 Replies

ActionScript 3.0 :: Passing Data From Document Class To Base Class?

Mar 1, 2011

I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.

In that document class I wrote:
package
{
import flash.display.*;
public class Main extends MovieClip

[Code]....

I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
 
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!

View 4 Replies

ActionScript 3.0 :: Passing A Variable From The Document Class Into A Custom Class?

Dec 28, 2009

I'm trying to create a class which will create a tween for several different instances of an object. I am creating the instances in the Document Class. The trick is, I would like to specify how long each tween will take.

Here's what I have so far:

DOCUMENT CLASS

ActionScript Code:
package {
import flash.display.MovieClip;
import mcCloud;

[Code].....

As you can see, I have a variable "myTime" which syncs the timer and the tween. This causes to tween to repeat and the clouds to continually scroll across the stage. How can I determine the var myTime at the time I create each instance of the Movie Clip mcCloud?

View 6 Replies

Passing Name Of Video To Be Loaded From Document Class To Another Class?

Aug 6, 2009

I've got a document class (EgoGame.as) and another class (Ball.as) which has been duplicated to deal with several different video pieces. Inside the document class is a list of 'if' statements which decide which video should be played. At the moment I'm doing it the old fashioned way whereby if the condition is true....it tells the relevant Ball class to gotoAndPlay a certain frame within the linked movieclip...

[Code]...

View 1 Replies

Professional :: Passing URL From FLA To Class

Jul 24, 2010

I have a class that works with an external swf with play, pause and slider. Now that I have all that working, I'd like to be able to pass the URL of the external SWF to the class from the main fla AS. I managed to use a 'set' inside the class to retrieve the name, but it apparently doesn't trigger until after the external SWF gets loaded.

Code snippets follow:
CntlClass:
public var loader:Loader;
private var _urlName:String;
public function CntlClass() {
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded);
loader.load(new URLRequest(_urlName));
public function set urlName(value:String):void {
_urlName = value;
}

Main FLA file - other than a controller (cntl_mc) containing a play button, a pause button, and a slider, the only thing in the FLA file is this code in the first frame:
cntl_mc.urlName = "extswf.swf";

View 5 Replies

ActionScript 3.0 :: Passing Class To Xml?

Oct 24, 2009

I am making a game project using tiles. I want to ask bout the xml.

I know how to load an xml data into the stage by using one class from library

However, rite now, I have 3 customer_mc with class for each: char1,char2,char3

And i have this xml data called customer_xml that contents the customer name,order and payment. So far i know how to call one class and do a for loop but i cant find a way to call three classes and put it into the for loop.

function init(xmlString:String):void {
customer_xml = new XML(xmlString);
for (var i:uint = 0; i<customer_xml.customer.length(); i++) {
var customer_mc:char1= new char1();

[Code].....

how can i put three customer mc into the for loop? Do I put it in an array?

Second, I don't want it to be put randomly on the stage but only on the right corner of the stage. Is that mean, I put a precise coordinate for the customers mc?

View 0 Replies

Actionscript 3 :: Passing Custom Class As Parameter To Custom Class Where Parameter Class Not Constructed?

Jun 16, 2011

I have a custom class being constructed from my main class. In the custom class it has another custom class that is passed in as a parameter. I would like to strictly type the parameter variable but when I do, 'the type is not a compile type constant etc'.This, I understand, is because the custom class used as a parameter has not yet been constructed.It all works when I use the variable type ( * ) to type the parameter.I suspect this is a design flaw, in that I am using an incorrect design pattern.It is actually hand-me-down code, having received a large project from someone else who is not entirely familiar with oop concepts and design patterns.

I have considered using a dummy constructor for the parametered class in my main class but the passed in class also takes a custom class (itself with a parametered constructor). I am considering using ... (rest) so that the custom classes' parameters are optional.Is there any other way to control the order of construction of classes? Would the rest variables work?edit)in main.as within the constructor or another function

var parameter1:customclass2;
customclass1(parameter1);
in customclass1 constructor:

[code].....

View 1 Replies

ActionScript 3.0 :: Passing Events Out Of A Class?

Apr 28, 2009

So I've created a custom class which makes use of a Sound object. The Sound object loads a sound from a URL, and I attach and event listener to it to see it when it finishes loading i.e. Event.Complete

MY question is this: how do I receive this event outside of the class? For instance, I want to be able to create an instance of my class somewhere else, load a sound and attach an event listener to my custom class that listens for the event thrown by the sound. Understandably, I don't want to make the sound object a public variable.

View 3 Replies

Actionscript 3 :: Passing A Font From One Class To Another?

Sep 16, 2010

I loaded a font.swf (in Flash CS5) and it works in the class I loaded the font into, but if I want to pass it to another class, how do I do that? I tried passing it as a TextFormat instance (with the format.font = my_loaded_font) but that doesn't appear to work...

View 2 Replies

ActionScript 3.0 :: Passing A Reference To Class

Nov 12, 2009

if i have multiple movieclips on the stage and i am writing a document class and in document class i import another class and i need to pass these movieclips to that class.

View 1 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 :: Video Class Passing Url Of Flv?

Feb 21, 2009

I have been trying to put the As3 video tutorial into a class which works fine if I keep the url of the file to play within the class. But I want to be able pass the url from the actual swf file... I have had limited success.

Here is the Document Class

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

[code]....

And in the swf I have this

Code: Select allvar v_url:VideoClass = new VideoClass("test.flv");

View 3 Replies

ActionScript 2.0 :: Passing Variable From One Class To Another?

Aug 30, 2007

well, i'm getting into flash classes, and i'm working on my first project using self written classes. but i got a question about variables.i've got a MC rad_container with the class Rad linked to it. By using class instances i can now send the variable from the MC to the class, and get it returned.but i want to use the same varhere's my class Rad

Code:
class Rad extends MovieClip {
public var ballKleur:String;

[code]....

View 4 Replies

ActionScript 3.0 :: Passing Url's For URLRequest() Class?

Aug 19, 2009

I am calling java servlets from flash using the following code[below is a sample Flash code for calling a java servlet in Flash which I am using]:

...bla ...bla
String url_String="http://localhost:8080/servlet/getViews";
var req:URLRequest = new URLRequest(url_String);

[code].....

View 6 Replies

ActionScript 3.0 :: Passing The Timeline To A Class?

Sep 16, 2009

I have the following class

Code:
package {
import flash.display.Stage;

[code]....

Which is not a document class. I wish to pass the stage of the main timeline into the class, say on frame 1

Code:
stop();
var c:CustomObject = new CustomObject(this.stage);

Is this the right way of passing the stage of the main timeline into another class?

View 1 Replies

ActionScript 3.0 :: Passing A Sting Into A Class?

Jan 12, 2010

I'm trying to pass a string from the main timeline into a variable within a class (public _myVar:String how i can acces the public variable within my class and populate it?

View 10 Replies

ActionScript 3.0 :: Passing The Stage Through Than One Class?

Mar 6, 2010

In my document class "Engine" I need to make my "Game Handler" class which is done in the constructor by using:

Code:
var Game:GameHandler = new GameHandler(stage);
As you can see, im passing the stage into it.. now in my GameHandler class

[code].....

View 5 Replies

ActionScript 3.0 :: Passing Stage To Another Class?

Apr 4, 2010

I have my FLA with a Document Class. I also have one other class, that doesn't extend anything. am trying to pass the stage from the FLA on to my non-Document class. Obviously, the Document Class can see the main stage no problem, but having trouble passing that stage to an external class.I tried to pass it from Frame 1 in my FLA. I also tried to pass it from my Document Class to my external class, but not working like it should.Code:var passStage:TitleClass = new TitleClass(stage)Now, on to my TitleClass (non-Document class / external class)

Code:
package {
import flash.display.*;

[code].....

View 3 Replies

ActionScript 3.0 :: Var Not Passing From Custom Class

Jan 26, 2011

I have created a custom class. It seems to work (at least no errors), but when I create a button in the actual FLA that calls on the class, it doesn't change what I want it to change. Here is the class:

[Code]...

When I call for the class to make the button, it works. It also successfull calls the default.png from the class, but in the FLA the icon_retrofit.myIcon doesn't change the image to 'images/b.png'.

View 2 Replies

ActionScript 3.0 :: Flash Passing Var To The Other Class?

Apr 3, 2011

how to pass the value of a variable in class1 to class2?

View 1 Replies

ActionScript 3.0 :: Passing Data From A Method Within A Class?

Jun 12, 2009

I am trying to pass an xmlList from this class, and am having some issues. The thing is, how can I call a method that listens for a result, then calls another method..

package com.ryancanulla.utils
{
import mx.rpc.events.ResultEvent;

[code].....

View 3 Replies

ActionScript 3.0 :: Passing In Root From A None Sprite Class (MVC)

Sep 24, 2009

I am working with a simple MVC pattern.

But in my model i try to do this:

Main(root).Message(" model done!");

But i cant pass in the root, couse the model classes are Eventdispatchers and no sprirtes.

View 1 Replies

ActionScript 3.0 :: Passing A Display List Name Out Of A Class?

Feb 26, 2010

I am trying to pass the display list name that is inside the trace statement back out of this class.  Essentially I what I want, is that when someone clicks on the "Button_mc" movie clip, I want to pass the instance name back to a different class  I've been trying to figure this out all day with no luck and I was wondering if someone would be willing to give me a hint.

package {  import flash.display.*;  import flash.events.*;
public class button_mc extends MovieClip public var
current_button_name:String;

[code].....

View 1 Replies

ActionScript 3.0 :: Passing An Object To A Class Function?

Apr 27, 2011

I keep getting this error #2007 i want to parse the stage and pass a bullet object to a class function that function is called every ENTER_FRAME in the class itself

because the bullet object is added to the stage and on the bullet, there is a event listener to call a function in a class every ENTER_FRAME

but now i want to delete this bullet as it leaves the screen on the top because bullets in this game can only fly upward.

this is some of the code so far in the class itself:

ActionScript Code:
package classes {
import flash.media.Sound;

[Code].....

View 5 Replies

ActionScript 3.0 :: Passing And Receiving Of Variable From One Class To Another?

Sep 2, 2011

My problem is when I try to make both class receive and send. It doesnt work.Here IF ONLY ONE CLASS SEND and 1 CLASS RECEIVE it works

Class A variable a ---> Class B variable _a; WORKS

Using this code:

My class A

ActionScript Code:
package  {
import flash.display.MovieClip

[code]....

But when I try to make them both receive and pass it says

Quote:

Error: Error #2136: The SWF file file:///E|/Andrew%20Documents/ColiisionDetection%20Kit/New%20Folder/passingandreceiving.swf contains invalid data.
at CLb()
at CLa()

Here is the code when they both receive and pass.

Class A

ActionScript Code:
package  {
import flash.display.MovieClip
import CLb;

[code]....

View 1 Replies

ActionScript 3.0 :: Passing Library Assets To Class

Oct 10, 2011

what I am trying to do is create class that loads assets(images) from library and places them on the a stage.I want my class to be something like this...I know it needs to be more complex, I am just trying to "draw" out my idea for you, I have tried using getDefinitionByName to pass the linked MovieClip and some variations on that but for some reason I can't get it to work.[code]

View 3 Replies

ActionScript 2.0 :: Class Member Passing OnPress

Feb 20, 2004

I have a class which controls a movie clip. The movie clip has a button in it. The problem is that I cannot use the class members in the onPress function of the button.[code]

View 2 Replies

ActionScript 2.0 :: Passing Variables Class And Function?

Feb 8, 2006

when I have access to my variables. I have the the follow code:

class Slider {
var myVar = 4;
function Slider () {[code]....

The slider function is being called first to update the myVar value then the findValue function is called. How do I get the find Value function to output 6 ? I want a function that updates the main classes' variable so thet I can use it from any function.

View 1 Replies

ActionScript 2.0 :: Class Member Passing OnPress?

Feb 20, 2004

I have a class which controls a movie clip. The movie clip has a button in it. The problem is that I cannot use the class members in the onPress function of the button.

[AS]
class Controller {
private var id:Number; // I have tried public also
private var myClip:MovieClip; // The clip that has the button

[code]...

View 2 Replies







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