CS3 : Pass A Variable Calculated In A Function
May 8, 2009how I can pass a variable calculated in a function, to the stage.
View 9 Replieshow I can pass a variable calculated in a function, to the stage.
View 9 RepliesIs 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")
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?
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]...
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.
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].....
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]...
Is there a way to pass a null variable through a function? For example:
[Code]....
How do I pass a variable into a Tween, lets say youve got a Tween like this[code]...
View 7 RepliesI 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 RepliesI 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].....
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 Repliesthe 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].....
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.)
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?
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?
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].....
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].....
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);
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...
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].....
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?
Trying to pass a variable as well and cant seem to escape to pass it. How can I pass using window.open as such: Trying to pass (pid) all i get back is (pid) and not actual pid.How to on a jscommand?
Code:
something.onRelease = function () {
var jscommand:String = "window.open('http://www.someform.php?proj= + (pid)','win','height=200,width=300,toolbar=no,scrollbars=yes');"; getURL("javascript:" + jscommand + " void(0);"); }
I can do a standard getUrl("http://www.someform.php?proj=" + (pid), "_blank"); works fine but no control over window properties.
I'm trying to pass the contents of variable playnoyes to the long line of code below to decide whether or not to autoplay the flash movie, but doing it as I have below, the resultant line of code has the variable in quotes and therefore the code doesn't execute it as expected. My question is, how can I pass the variable so that the resulting line of code doesn't have the quotes around the variable value.
var playnoyes='true';
var testtext = "<script type='text/javascript'>AC_FL_RunContent ('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.[code]....
I am trying to do is declare a variable in PHP and pass that variable to my flash file. Right now i am simply trying to do 1 easy variable, more will happen in the future but i need to figure this out first.I have used other forums and they say try this and that, but nothing i do seems to work. here is my code.
PHP Code:[code].....
I have a public variable and I am trying to set it, then read it from a different function:
public var str:String;
public function DailyVerse()
{
function create() {
[Code]....
My trace results says null. Why does it not give me "hello"?
I'm trying to update a clients site and the original developer left almost no instructions.The code is all updated through XML.Here is a sample of the code
enter code here<FOLDER NAME="COMMERCIAL">
<GALLERY NAME="LOCANDA VERDE: New York">
<IMG HEIGHT="500" CAPTION="Some photo" WIDTH="393" SRC="locanda1.jpg" DX="60" DY="40"
[code].....
I'm having some trouble passing parameters with a function that is itself being passed as a parameter.In my application code I'm instancing that class five times:they are buttons in a menu.In that class, I've got an onRelease handler that does a number of things when a button is released, one of which is to invoke a function that is defined in the application level of the code.My problem is that I don't know how to send the function parameters.In my StandardButton class I have:
class StandardButton extends MovieClip
{
/* define properties */[code]..........
The function is successfully being "sent" to the StandardButton class, but without any parameters.How can I send parameters to the class instance with the way I've got this architected.
I am trying to pass a variable with brackets in the variable name. Example
productoption[]="value";
Whenever I publish the file flash gives me an unexpected "]" error code. Is it possible to have a variable name with brackets? I tried to use the escape codes %5B%5D to pass the brackets but that didn't work also.
i write my own code for php and actionscript...and i had a problem with it.. How to pass php variable to action script variable?
[Code]....