Flash :: Use MovieClip Target Name To Pass Variable To Function
Feb 22, 2012
How can I combine the following functions and still pass a different string to the buildUI(); function?
I have two functions that do the same thing only at the end they both call a function and pass a String value to the function. This string value is the only thing different.
Below is are my eventlisteners and functions as they are now:
female_start.addEventListener(MouseEvent.MOUSE_DOWN, startFemale);
male_start.addEventListener(MouseEvent.MOUSE_DOWN, startMale);
//FUNCTIONS THAT DO THE SAME THING AND BOTH CALL buildUI BUT PASS A DIFFERENT STRING.
[Code].....
View 1 Replies
Similar Posts:
Nov 20, 2008
I have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:
package{
import flash.display.*;
import flash.events.*;[ code].....
I have new a object in the main stage var
mc_rect:MC_Rectangle = new MC_Rectangle()
in main stage:
1. how can i access the variable "sequence" in "mc_rect"
2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?
3. how can i call the function in addSequence() in mc_rect.
in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?
View 1 Replies
May 31, 2010
Is is possible to pass easing function as variable in AS3?g.
TweenLite.to(mcDelimiter, resizeTween, { x:(stageWidthHalf-(initStageWidthHalf-mcDelimiteri_X)), ease:Elastic.easeOut } );
TweenLite.to(mcBody, resizeTween, { x:(stageWidthHalf-(initStageWidthHalf-mcBody_X)),
[code].....
View 2 Replies
Aug 4, 2010
I have an external log file which name changes each session, with the format XXXXX.log I need to load it inside a swf to show its data, but each time the log's name is different, I need to open the .fla, changing the name of the file and then republishing the swf. So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:
[Code]...
View 2 Replies
May 8, 2009
how I can pass a variable calculated in a function, to the stage.
View 9 Replies
Dec 21, 2009
Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.
Code:
var text:String = "Goodbye World";
function myfunction ( varToChange)
{
varToChange = "Hello World";
}
myfunction("text")
View 2 Replies
Nov 8, 2005
I was just wondering if it's possible to pass a variable from one swf to a function on another swf?
I have 2 containers on my main stage, each one loads an external swf, I want one to send a variable to a function in the other container.
I simply tried calling the function by doing _root.container2.fncTest("works"); just to see if it works
and in container2 I have
Code:
function fncTest(test):Void {
myText = test; //dynamic text box on the stage
}
but that didn't seem to work.. Do I have to make the function public or that only works for classes?
View 13 Replies
Mar 18, 2009
Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.
[Code]...
View 1 Replies
Apr 15, 2006
I need to feed the path of a target to a function and it needs to rewrite to set a value to it. example below
[Code].....
Basically it works if it's only one target name with no previous/subsequent targets like path1 works but not path1.box is there any way to fix this?
View 10 Replies
Aug 6, 2010
I have an external log file which name changes each session, with the format XXXXX.log
I need to load it inside a swf to show its data, but each time the logs name is different, I need to open the .fla, changing the name of the file and then republishing the swf.
So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:
Code:
var logNumLoader:URLLoader = new URLLoader();
logNumLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
logNumLoader.addEventListener(Event.COMPLETE, loadedLogNum);
[Code]....
While I cannot assign the value of logNum to the last function, the .log cannot be opened.
View 2 Replies
Jul 25, 2009
Is there a way to pass a null variable through a function? For example:
[Code]....
View 1 Replies
Aug 5, 2009
How do I pass a variable into a Tween, lets say youve got a Tween like this[code]...
View 7 Replies
Nov 19, 2009
I have a number of nodes that are plotted on stage. I want to display the value of each node when hovering over the node (using the Tooltip class). [code]...
View 4 Replies
Aug 30, 2010
I am trying to get the score variable back but it says function is not passing back variable. Here is my code.
Code:
var score:Number;
function btnCheck(myevent:MouseEvent):Number {
if (input_txt.text == myTypeCheck) {
gotoAndStop(forwardFrame);
[Code].....
View 4 Replies
Oct 5, 2011
Is there a way to pass a variable to the timer function effectively changing the length of the timer when it runs.[code]...
View 2 Replies
Apr 24, 2006
the idea is that the site keeps tracks of whatever page is current and passes this variable to the alpha function which will target that movie instance to fade when moving to another page - then that page's name will be assigned to current.this is the code that i have now..
#include "alpha.as"
evolution.onRelease = function() {
this[current].gotoAndPlay(2);
[code].....
View 5 Replies
Oct 6, 2009
I'm trying to pass a variable to another frame but it's not working, can anyone please explain how to do this.
(I'm trying to build a video player--I have buttons for various videos on one frame and the player on another frame.)
View 4 Replies
Jan 15, 2011
So i have 4 buttons, that represent values: 10, 50, 100, 1000
When i click one of them i what a global variable declared: pulic var stake:int = 0; to e initialized with the value of the button pressed.
So i have the following code:
stake0050_btn.addEventListener(MouseEvent.CLICK, changeStake);
i would like to have a function changeStake, witch will update a variable called stake.
How can i tell the event listened to call changeStake with an argument?
View 5 Replies
Aug 29, 2008
How do i pass a variable to a function from an event listener which is inside a function Below is a function that is called when after loading some variables
function dataOK(mydataevent:Event):void{
var j:int = 0;
do {
trace(j);
[Code]....
This is a simplified version of the original code. The above function generates an error because j is undefined in the function. I am wanting to get the variable j when the button is pressed.
How do I pass the variable j to the Button_Click function?
View 1 Replies
Feb 6, 2011
I am running a loop to pull thumbs into a containing movieclip from an xml list. What I want to do is have the thumb's parent movieclip fade in after they are done loading, but I can't figure out how to reference the parent once it's loaded.My code(which currently doesn't work the way I want it):
var vsThumb:articleBox;
var currentarticleX:Number = 0;
var articleLinkURL:String;
[code].....
View 2 Replies
Jan 30, 2009
How do I pass a variable to function when calling it with interval.
This:
Code:
doFlip(1);
to something like this:
Code:
myInterval = setInterval(doFlip(1),2000);
View 2 Replies
Feb 7, 2005
Code:
onEnterFrame = traceMe("test")
traceMe = function(param){
trace(param)}
If that won't work then would someone explain how you get something to execute a predefined function and pass a variable...
View 1 Replies
Feb 4, 2009
I am trying to define a new MovieClip variable and assign it the value of event.target in the function. I keep getting this error "1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:MovieClip."
import fl.transitions.Tween;
import fl.transitions.easing.*;
var p:Number = 0;
var scale_factor:Number = 0.4;
var tween_duration:Number = 0.6;
[Code] .....
View 9 Replies
Sep 29, 2011
I am creating a quiz and I set one quiz block with questions into a movieclip. When the person answers the correct answer I want it to add to a counter and pass that value onto the next movieclip. So movieclip one is added to the stage it does something then adds a counter. Then moves to the next frame and movieclip2 is added to the stage. It does something and add to the same counter variable from movieclip1. And so on and so on until no more movieclips.
View 1 Replies
Jan 9, 2008
I have this functions which attaches movieclips on the Stage and makes them move clockwise. The problem is I cant pass the radius[i] variable to the new movieclips.
Code:
function placeItems(itemName:String, num:Number) {
var angle:Number = 0;
var radius:Array = new Array();
for (var i:Number = 0; i<num; i++) {
radius[i] = Math.floor(Math.random()*100);
[Code] .....
View 2 Replies
Feb 20, 2012
I COMPLETELY MESSED UP MY CODE AND DID NOT CHANGE THE MOVIECLIP NAMES WHEN COPING IT INTO STACKOVERFLOW. SO IT MADE NO SENSE.
I am wondering if there is a better way to accomplish the following as3:
//THREE EVENT LISTENERS
shoe_icon.addEventListener(MouseEvent.MOUSE_DOWN, shoeApp);
top_icon.addEventListener(MouseEvent.MOUSE_DOWN, topApp);
[Code].....
View 4 Replies
Dec 26, 2011
I have a document with main class.I also have some movieclips which have their own class and functions.I am trying to pass a variable from my main class to one of these MovieClips.I tried some stuff, nothing worked.
View 11 Replies
Oct 27, 2010
I'm trying to make some tables. I have some movie clips:
cella1
cella2
cella3
[code]....
View 5 Replies
Dec 13, 2009
I need to pass a variable value contained within a MovieClip to my class file. The MovieClip is my preloader, to which my code will show that upon the initial launch of the SWF. Until the variable is sent, my code assumes the preloader is still running and therefore will not progress. Originally, it was working when I had my class file extend MovieClip and then used this code in the preloader MC:
[Code]....
View 1 Replies
Mar 28, 2012
I have a Flash Professionl AS3 project I am working on.
I have this in a main movie:
but1b.addEventListener(MouseEvent.CLICK, fbut1b, false, 0, true);
function fbut1b(e:MouseEvent):void{
var mc:documentwindow_mc=new documentwindow_mc();
mc.x=450;
[Code].....
The issue I have is I need to do this 40 times.
Is there a way for me to use the same documentwindow_mc movie clip and pass a variable to change the "documents/print2flashdocument1a.swf", part?
How could I do this from the fbut1b function?
View 3 Replies