ActionScript 3.0 :: Function That Pulls In Values To Save Writing 15 Separate Functions?

Nov 18, 2009

I have just started learning AS3 (2-3 weeks) and I have to say its very enjoyable!I am trying to make a function that pulls in values to save me writing 15 separate functions!I have a "street mc" which has 15 "house mc's" inside.When the user hovers over a house I want the resident to appear above the house.The house instance name is house1 and there is a mc in the library linked using the MrsRoy() class.This is my code so far:

Code:

var house1Res:MovieClip = new MrsRoy();
function resIconIn(e:MouseEvent):void{
var currentHouse = "street." + e.target.name;
var currentRes = e.target.name + "Res";

[code]....

I get the error:

TypeError: Error #1006: value is not a function.
at Dignity_drive_fla::MainTimeline/resIconIn()

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Multi-functions -values Of (12) And (21,39) Are Lost At The Geo And Geo1 Functions ?

Dec 2, 2004

in this example why the values of (12) and (21,39) are lost at the geo and geo1 functions

[code]...

View 11 Replies

Performance :: Writing Down These Functions In A More Sophisticated Way?

Sep 9, 2011

I'm creating a simple scratch game (6 cards). It doesn't even have to contain difficult logic. You eventually win all the time ;)The code i wrote works pretty well, but i keep thinking it could be better. I'm not too familiar with coding, but i'm learning step by step. Do you have ideas to write this down in a cleaner and more sophisticated way?.g. I tried to separate the IF statement that returns in every function, so i would only have to write it down once, but i didn't succeed

//set card variables to 0 and when they're scratched, they're changed to 1
var checkCard1:int = 0, checkCard2:int = 0, checkCard3:int = 0, checkCard4:int = 0, checkCard5:int = 0, checkCard6:int = 0;

[code].....

View 1 Replies

ActionScript 3.0 :: Writing Getter And Setter Functions?

May 26, 2010

I have two functions one that sets and one that gets a number. The set one works, but the get one doesn't. I have it trace the set it returns the correct number, but when I set the getY function, it doesn't give me anything at all. When i took the number out of the trace it just gave me back only text. What am I doing wrong here?

ActionScript Code:
public function setY(y):void {
y = y;

[code].....

View 2 Replies

ActionScript 2.0 :: Save And Load Data To And From Variables - Reading From And Writing To Textfiles

Nov 26, 2003

I need to save and load data to and from variables. I know how to read from text-files, but not how to write to them. The text-files should work as a "database" for the high-score in a game, I cant use php cause the computer running the game wont be online all the time.

View 6 Replies

ActionScript 3.0 :: Link Two Separate Functions?

Jan 31, 2010

i'm kind of beginner/intermediate level (more so beginner i'd say) at AS3, and i'm trying to make a tower defence style game... ATM i'm using internal code, but would it be better to switch to external?Anyway, the problem is, at the moment i'm not sure how to impelment a way of saying, if an enemy spawn hit tests "icearea" then just trace ("in range"); but i get errors no matter where i insert the equivlent code...[code]

View 3 Replies

ActionScript 3.0 :: Defining Functions In A Separate .as File?

May 5, 2010

I would like to know if this is actually possible in AS3. I'm not really fluent in Java-style programming, but very used to C++'s .cpp and .h file system. Right now my functions are defined where my class is defined, so as you can imagine, my classes look incredibly untidy and disorganized.

[Code]...

View 6 Replies

ActionScript 3.0 :: Placing Functions In Separate AS Files?

Jul 30, 2009

This is doable in almost every language ive coded in. I would like to place a function in a separate .as file, as to not clutter up my main .as file. Ive already got about 15 classes in separate files and I know there must be some way to do this and its got to be pretty obvious.

View 7 Replies

ActionScript 3.0 :: Accessing Functions In Separate File?

Feb 5, 2010

I'm working on an mp3 player. It makes use of a custom scrollbar I found here: [URL]

I've gotten it to work so far, but there is one bit I would like to add. I would like it to scroll to specific y-coords when a button is clicked. The code for the scrollbar is all in an external AS file, which is referred to by an exported movieclip in the main fla.

how I would go about referring to this file, or just some other method of doing this? I'll paste the AS code as well as the basic fla code.

fla code:

Code:
var s:Sprite = new Sprite();
txt_mc.spacer.visible = false;
sb.init(txt_mc, "easeOutBack",0,true,2);

[Code]....

View 3 Replies

ActionScript 2.0 :: Compare Values Of Two Separate Datagrids?

Jun 7, 2008

how to compare values of two separate datagrids.for example lets say i have a datagrid named mg_dg like this:

PHP Code:

[code]...

this is sorta what i'd like to accomplish but not in the sense of using a textinput component.it filters the datagrid of the text typed into the textinput component.

View 2 Replies

Professional :: Save Unused Symbols To A Separate Library?

Oct 6, 2011

I would like to keep my project library tidy, which means deleting symbols I end up not using. However, I want to be able to find these symbols later in case I do end up wanting to use them for a related project. Can I create a library outside of a project, so I can drop these items into it for later use?

View 1 Replies

ActionScript 3.0 :: Single TextField Value Into Separate Array Values?

May 28, 2011

SlideTitles.text is an input field. I want the user to enter the titles in in this format

slide one;;slide two;;slide three

Calling the slides whatever they want, and they can have as many as they want.

I need to able to split them values up and put them into a string array. (after they submit them)

so it would end up being myStringArray = ("slide one", "slide two", "slide three")

so far i'm failing. I did do a bit of searching around but couldn't find anyone doing this same thing.

I've tried myStringArray = (textfieldsxx)

and then setting the value of textfieldsxx to equal the slideTitles.text... but then it just ends up as 1 value in the array, no matter what format i write it in... i'm still a learner with arrays

View 1 Replies

ActionScript 3.0 :: Remove Event Listeners In Separate Handler Functions?

Sep 17, 2010

I've managed to create a button which on MOUSE_DOWN scales its parent object- it works just like windows in your OS, where you grab the corner and can change the scale of the window.

Here's how I've done it, (minus the MOUSE_DOWN listener)

Code:
function scaleDragHandler(event:Event):void {
var mcWidth:Number = event.target.parent.width;
var mcHeight:Number = event.target.parent.height;

[Code].....

However, it throws the error, "Access to undefined property 'scaleMC'" on the removeEventListener line. My thought was to put another listener for mouse up inside the first, but that sounds wrong

View 2 Replies

ActionScript 3.0 :: Creating Separate Functions For Each Button And Added The Line RemoveChild() - Statement

Jan 7, 2012

I am trying to load various swfs into a main swf. The initial swf loads in by default, the others load when buttons are clicked. All of the buttons also call a lengthy function called loadpic which appears later in the code - Currently the buttons load in the swfs as required, however the swfs are always behind the initial default swf. Is there a way to add removeChild to the buttons? I have tried creating seperate functions for each button and added the line removeChild(); however doing that means I would also have to repeat all of the later functions as well. If I add removeChild(); without placing it in a function the default swf doesn't show at all.

[Code]....

View 9 Replies

ActionScript 2.0 :: Getting Values Out Of Functions?

Apr 19, 2004

I have a function that I want to get an array out of. Do I just return the array to the function, and when I call the function set it equal to a variable?

View 1 Replies

Flex :: Passing Values Between Functions

Jul 2, 2009

is there any way to locally define a variable in a function and then pass it to the oher function. I mean to say is it possible the pass a local value from one function to other function.

View 3 Replies

ActionScript 2.0 :: Values Used With Functions [renamed]?

Sep 11, 2005

For example:

myFunc = function (p1, p2) {}
Or:
myFunc = function (ab) {}

[code].....

View 3 Replies

ActionScript 3.0 :: Save Variables To Be Used Out Of Events And Functions?

Feb 23, 2010

I'm working on a project for school which is requiring me to make a game using Flash and ActionScript 3.0. One of the tasks I have to do is load an external XML file that will be displaying questions and answers. I've looked at google to find simple scripts for loading XML, one example being below:

Code:
var myXML:XML;
var myLoader:URLLoader = new URLLoader();

[code].....

View 1 Replies

ActionScript 2.0 :: Save Time And Space With Functions?

Jan 12, 2011

I was wondering if there is something that I can write (a function? I don't know what they are or how they work ) so that I don't have to rewrite code. [code]...

View 1 Replies

ActionScript 3.0 :: Writing An Event Listener And A Function For Each Button

Oct 13, 2009

I have a set of buttons on, and what i would like to do is change the value of a variable, depending which button you are over.i know i could do this by writing an event listener and a function for each button, but this is too time consuming.I'm sure in the old days it would have been as simple as if btnwhatever.mousedown = true then.... but now i have no idea.

View 1 Replies

ActionScript 3.0 :: Losing Variable Values Between Functions?

Nov 9, 2009

I'm trying to do something simple in actionscript as simple as this:- Create a variable: var urlVideo:String;- Use that variable inside a function and give it a value: urlVideo = ideoElemento.url.text();- Then create a new variable and give it the urlVideo value: var url:String = urlVideo;

Here's my code:
var idVideo:String = "12";
var urlVideo:String;

[code]....

View 14 Replies

Flash :: Passing Values Through Functions In Mxml?

Feb 11, 2012

I currently have a basic application where we have multiple buttons, which have functions activated by "click" event listeners on those buttons. The issue is that each button does more or less the same function; just the data that is loaded for each button is different. How do I make it so I'm able to recycle the same function? In Javascript or AS3 something along these lines would be done...

<s:Button id="btn_1" x="378" y="601" label="Button 1" click="photoSwap(event,"image1.jpg")"/>
<s:Button id="btn_2" x="350" y="601" label="Button 2"

[Code].....

But that's obviously not how it works. I've tried trouble shooting the issue but haven't been able to find anything. It works when I have each button having its own function, but that seems really silly and shouldn't need to be done.

View 1 Replies

ActionScript 3.0 :: Pass Variable Values Between Functions?

Oct 16, 2009

How do you pass variable values between functions where the addEventListener is in the first function? I am trying to get the color value passed into my event handler. [code]...

View 6 Replies

ActionScript 2.0 :: Save Some Variable Values Into A Local Machine?

May 28, 2005

I want to know how to save some variable values into a local machine... as for example a save button. Then the user plays the movie again the variables show up as he left them. I think this is done by SharedObject or something like that...

View 2 Replies

ActionScript 3.0 :: Flash Event.REMOVED_FROM_STAGE - Writing A Cleanup Function For MC?

Nov 29, 2011

[URL] I needed to do clean up before the MC is gone ... so after some digging I found this event:

Event.REMOVED_FROM_STAGE

So I am trying to ask for some conformation here: Is this the ONLY situation that my MC will be deleted automatically by Flash? If so then I can just listen to this even and call my cleanup function when it happens...

View 1 Replies

Actionscript 3 :: Flex Dynamically Changing Values Between Functions

Jun 3, 2011

I have a main mxml and 2 AS classes.In the main mxml I have a slider.I want to get the slider values in AS classes as I move the slider.

Main.MXML
import First;
import Second;

[Code]...

I could get the values from trace(dat)....I mean the date's as the slider changes. How could I use this changing values in function visualization()

View 1 Replies

ActionScript 3.0 :: Writing Function For Buttons - Pass A Unique File Name To Asp Page

Sep 17, 2009

each of six buttons need to pass a unique file name to an asp page... below is the code for the six buttons... obviously this won't work, but it give you an idea of what i need to happen...

[Code]...

View 1 Replies

Actionscript 3 :: Testing - Writing/compiling A Block Of Code Without A Class Or Function?

Feb 7, 2011

Having done some programming in Groovy, I know you can write test code in the Groovy console. I classify this as true a scripting language as it doesn't force you to have a class definition. So I'd assume with a name like ActionScript with 'script' in it's name that, you can write a series of statements that act linearly, such as a sequence of variables assignments, their manipulation and dumping out a value.

My question is if this is possible, how do you go about doing it, in order to test some code with ActionScript3? Does the code have to exist in a package?Can the code exist on it's own? (If so, what would the name be you'd give to the source file in order to compile it from the command line?

Would you use mxmlc?

Would you use compc?

I've heard about fsch too. How about that?I also read about a command called 'asc' in R.Braunstein's AS3 Bible 2nd ed (P8), but don't even see this in the SDK bin folders.... So what's that all about? Assuming I've managed to compile this name.as file, how do I execute it and see results? Do I have to run it through a browser and the HTML template, or can I execute from a command line?

Do you have to have a class in the source to bypass this? Can the code block be placed outside a dummy class? If so, does it have to exist in a function? Or can it exist on it's own?Does it have to exist in a code blocks, by wrapping them in curly braces?

View 2 Replies

ActionScript 3.0 :: Execute Callback Functions Dynamically By Passing A Function In As An Argument To Another Function?

Apr 21, 2010

How do I execute callback functions dynamically by passing a function in as an argument to another function?

Look at this example:

Code:
package {
public class myClass extends MovieClip {
public function myClass(callback) {

[code]....

View 2 Replies

ActionScript 3.0 :: Calling A Function In A Separate .as File?

Nov 20, 2009

I have 1 .fla and 2 .as files. The first .as file is called documentClass and is the document class for the .fla. The second .as file is called tracePrac contains a function that traces a varible in tracePrac.as. I want to know how i call for this function in my documentClass.as code?

Code:
package {
import flash.display.MovieClip;

[code].....

View 2 Replies







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