Pass Variable To Function
can anyone tell why this wouldn't work? These functions do not properly pass the parameters I need them too. Starts at btn.onRelease :::
ActionScript Code: function buttonPress(btnName, sectionName) { if (_root.section != sectionName) { _root.section = sectionName; _root.transitionContent.gotoAndPlay("closing"); moveFollower(btnName); }};function moveFollower(clip) { _root.follower._y = clip._y;};btnHome.onRelease = buttonPress("btnHome", "content_Home.swf");btnAboutUs.onRelease = buttonPress("btnAboutUs", "content_AboutUs.swf");
Note: btnHome = instance name of a button btnAboutUs = instance name of a button follower = instance name of static mc
Thanks
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 01-13-2004, 01:39 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Pass Out A Variable In A Function
Hey,
How can I pass out a variable from a function? So as to set the value of a variable in the same scope that the function was called?
For example (doesn't work...):
function save(vari:Number):Void {
vari = 50;
}
var big:Number;
save(big);
trace(vari);
So as you can see it doesn't do what I want it to do, as it traces undefined (which is expected...). It passes in "big", as vari, which is undefined, then sets it as 50. I don't want that though.
Hopefully you understand what I am asking.
Thanks in advance!
Can You Pass Variable From Within Function?
2 basic questions:
1. Can you pass a 'var' from within one function to another?
2. How do you do it???
Want to pass 'ObjectID' which is made up from a result value into the 'my3d' function. Doesn't register it at the moment?
Code:
public function cbPages(result:Object):void {
var objectID:String = result.title;
trace(objectID);
}
override protected function my3d():void {
cow=new Collada(objectID);
default_scene.addChild(cow);
}
Many thanks for your help in advance.
Can You Pass Variable From Within Function?
2 basic questions:
1. Can you pass a 'var' from within one function to another?
2. How do you do it???
Want to pass 'ObjectID' which is made up from a result value into the 'my3d' function. Doesn't register it at the moment?
Code:
public function cbPages(result:Object):void {
var objectID:String = result.title;
trace(objectID);
}
override protected function my3d():void {
cow=new Collada(objectID);
default_scene.addChild(cow);
}
Many thanks for your help in advance.
Pass Variable Into Function
This has probably been asked before , but why can't you pass a variable from the first function into second function that resides in the first function?
I am trying to pass the _global.docmp3 value into the rollover function. I can trace the value outside of the rollover function but apperantly once your inside the rollover function is gets lost.
I have a movie clip on the stage called dmp3, it contains a dynamic text file called mp3name. What shows up in the text box is "undefined"
ActionScript Code:
_root.stop();
////////////////////////// LOAD ID txt FILE //////////////////////////////////
MyLoadCID = new LoadVars();
MyLoadCID.load("CdTypes/ID.txt");
MyLoadCID.onLoad = function(success) {
if (success) {
myVar = MyLoadCID.ID;
info(myVar);
} else {
trace("not loaded");
}
};
//////////////////////////// START FUNCTION INFO ////////////////////////////////
function info(myVar) {
MyLoadVars = new LoadVars();
MyLoadVars.load("CdTypes/"+myVar+"DOCUMENT.txt", "document");
MyLoadVars.onLoad = function(success) {
if (success) {
for (i=0; i<10; i++) {
//check for undefined
if (this["name"+i] == undefined) {
_root["press_mc"+i]._x = 800;
} else {
//this creates the text field
_root.attachMovie("PressText", "press_mc"+i, 60+i);
_root["press_mc"+i].name.text = this["name"+i];
_root["press_mc"+i]._x = 300;
_root["press_mc"+i]._y = 150+(i*20);
//sets the text width to character length
_root["press_mc"+i].name.autoSize = true;
///////////////////////////////////////////////////
//this creates the button it overlays the text at a higher level
_root.attachMovie("PressText1", "press_mc1"+i, 70+i);
_root["press_mc1"+i].name1.text = this["pdf"+i];
_root["press_mc1"+i]._x = 300;
_root["press_mc1"+i]._y = 150+(i*20);
//font has to be embeded for alpha to work
_root["press_mc1"+i]._alpha = 0;
// set both text boxes to same width
_root["press_mc1"+i].name1._width = _root["press_mc"+i].name._width;
///////////////////////////////////////////////////
//add the document icon
_root.attachMovie("press_icon", "icon"+i, 85+i);
_root["icon"+i]._x = 275;
_root["icon"+i]._y = 145+(i*20);
//
// add the documents voice over
_global.docmp3 = +this["dmp3File"+i];
trace(docmp3);
_root["press_mc1"+i].onRollOver = function() {
trace("mp3 name "+docmp3);
dmp3.mp3name.text = this.docmp3;
};
_root["press_mc1"+i].onRelease = function() {
//
getURL("Documents/"+this.name1.text, "_blank");
};
}
}
} else {
trace("not loaded");
}
};
}
Pass Variable Out Of Function
I am wondering how I would pass a variable out of a function. For example, how do I pass the variable of myIntro out of the function below?
Attach Code
myURLLoader.addEventListener(Event.COMPLETE, dataOK);
function dataOK(myevent:Event):void {
var myXML:XML=new XML(myURLLoader.data);
var myIntro:String = myXML.introduction;
}
Pass Variable To Function
can anyone tell why this wouldn't work?
These functions do not properly pass the parameters I need them too.
Starts at btn.onRelease :::
ActionScript Code:
function buttonPress(btnName, sectionName) { if (_root.section != sectionName) { _root.section = sectionName; _root.transitionContent.gotoAndPlay("closing"); moveFollower(btnName); }};function moveFollower(clip) { _root.follower._y = clip._y;};btnHome.onRelease = buttonPress("btnHome", "content_Home.swf");btnAboutUs.onRelease = buttonPress("btnAboutUs", "content_AboutUs.swf");
Note:
btnHome = instance name of a button
btnAboutUs = instance name of a button
follower = instance name of static mc
Thanks
Can You Pass Variable From Within Function?
2 basic questions:
1. Can you pass a 'var' from within one function to another?
2. How do you do it???
Want to pass 'ObjectID' which is made up from a result value into the 'my3d' function. Doesn't register it at the moment?
Code:
public function cbPages(result:Object):void {
var objectID:String = result.title;
trace(objectID);
}
override protected function my3d():void {
cow=new Collada(objectID);
default_scene.addChild(cow);
}
Many thanks for your help in advance.
Can't Pass Variable To RollOver Function
I am having trouble passing the _global.docmp3 into the onRollOver function. I can trace the global variable outside the of the RollOver function but once inside the I lose it.
I have a movie clip called my_mp3 with dynamic text called mp3name.
Any help appreciated.
Code:
_root.stop();
////////////////////////// LOAD ID txt FILE //////////////////////////////////
MyLoadCID = new LoadVars();
MyLoadCID.load("CdTypes/ID.txt");
MyLoadCID.onLoad = function(success) {
if (success) {
myVar = MyLoadCID.ID;
info(myVar);
} else {
trace("not loaded");
}
};
//////////////////////////// START FUNCTION INFO ////////////////////////////////
function info(myVar) {
MyLoadVars = new LoadVars();
MyLoadVars.load("CdTypes/"+myVar+"DOCUMENT.txt", "document");
MyLoadVars.onLoad = function(success) {
if (success) {
for (i=0; i<10; i++) {
_global.docmp3 = this["dmp3File"+i];
//trace(docmp3);
//check for undefined
if (this["name"+i] == undefined) {
_root["press_mc"+i]._x = 800;
} else {
//this creates the text field
_root.attachMovie("PressText", "press_mc"+i, 60+i);
_root["press_mc"+i].name.text = this["name"+i];
_root["press_mc"+i]._x = 300;
_root["press_mc"+i]._y = 150+(i*20);
//sets the text width to character length
_root["press_mc"+i].name.autoSize = true;
///////////////////////////////////////////////////
//this creates the button it overlays the text at a higher level
_root.attachMovie("PressText1", "press_mc1"+i, 70+i);
_root["press_mc1"+i].name1.text = this["pdf"+i];
_root["press_mc1"+i]._x = 300;
_root["press_mc1"+i]._y = 150+(i*20);
//font has to be embeded for alpha to work
_root["press_mc1"+i]._alpha = 0;
// set both text boxes to same width
_root["press_mc1"+i].name1._width = _root["press_mc"+i].name._width;
///////////////////////////////////////////////////
//add the document icon
_root.attachMovie("press_icon", "icon"+i, 85+i);
_root["icon"+i]._x = 275;
_root["icon"+i]._y = 145+(i*20);
//
_root["press_mc1"+i].onRelease = function() {
getURL("Documents/"+this.name1.text, "_blank");
};
//
trace(docmp3);// ok here
_root["press_mc1"+i].onRollOver = function() {
trace("nope "+this["dmp3File"+i]);//fails
trace("mp3 name "+this.docmp3);//fails
my_mp3.mp3name.text = +this.docmp3;
};
//
}
}
} else {
trace("not loaded");
}
};
}
Pass Variable Reference Into Function, Not By Value
hi,
is there a way to pass the reference of a variable(a) into a function so that when a's value is changed in the function, the actual variable value is changed and not only the a in the function?
i have this code snippet below =>
ActionScript Code:
//this code is on frame 1 of the main timeline
logoFaded = false;
function alphaFaded(obj, targ, speed, dir, flag){
obj.onEnterFrame = function(){
temp = obj._alpha + speed*dir;
obj._alpha = Math.min(100,Math.max(temp,0));
if(obj._alpha >= targ){
if(flag !== undefined){
flag = true;
trace(flag);
}
delete this.onEnterFrame;
}
};
}
//this code is on frame 2 of the main timeline
//its purpose is to monitor the alpha tween carried out by alphaFaded()
_root.createEmptyMovieClip("logoFadeListener_mc", 1);
logoFadeListener_mc.onEnterFrame = function(){
if(logoFaded == true){
trace("Logo fade in complete...");
gotoAndPlay("mainTransition");
delete this.onEnterFrame;
this.removeMovieClip();
}
};
alphaFaded(_root.logo_mc, 100, 5, 1, logoFaded);
stop();
the variable "logoFaded" that's declared and initialised on frame 1 is being passed into alphaFaded() by value currently and only the variable "flag" is set to true.
i tried to attach a variable to logoFadeListener like this but it didnt work as well
ActionScript Code:
_root.createEmptyMovieClip("logoFadeListener_mc", 1);
logoFadeListener.logoFaded = false;
alphaFaded(_root.logo_mc, 100, 5, 1, logoFadeListener.logoFaded);
How Do You Pass A Variable In A Function To Another Frame?
I'm building an app where I ask a user to name a project to start.
When they click the start project button, it places a movieclip (new_project_window) on the stage that has a dynamic text field (project_name) and a button (new_project_window_button) in it.
When the button is clicked, it triggers a function that writes out a folder on the user's drive with whatever the user has put in the dynamic field (I'm using Zinc for that).
All this is working exactly as I want it to. The problem now is after they start a project, I want to move them to another frame where they fill in some info about the project (name, address, etc.). All this info will go to an xml file that will be in the folder they created above, with the name of the folder being the value of the dynamic field.
So I need to pass the value of the dynamic text field, which is captured inside the function I've created, on to the next screen.
Here is the code of the function I've written:
Code:
//code for starting a new project
new_project_window.new_project_window_button.onPress = function():Void {
if (new_project_window.project_name.text == ""){
new_project_stop();
}
else {
//creates file structure for a new project, relative to root level of app
mdm.FileSystem.makeFolder(currentPath+"/projects/"+new_project_window.project_name.text);
mdm.FileSystem.makeFolder(currentPath+"/projects/"+new_project_window.project_name.text+"/xml");
mdm.FileSystem.makeFolder(currentPath+"/projects/"+new_project_window.project_name.text+"/images");
mdm.FileSystem.makeFolder(currentPath+"/projects/"+new_project_window.project_name.text+"/pdfs");
//parses the master xml file for new project titles
project_names.ignoreWhite = true;
var pRootNode:XMLNode = project_names.firstChild;
var pChildren:Array = pRootNode.childNodes;
//writes out new xml file of master projects, appending new project name to list
var LFCR:String = "
" + "
";
var xmlStr:String ="";
xmlStr +="<projects>";
for (var i = 0; i < pChildren.length; i++) {
xmlStr +="<project>"+pChildren[i].firstChild+"</project>";
}
xmlStr +="<project>"+new_project_window.project_name.text+"</project>";
xmlStr +="</projects>";
mdm.FileSystem.saveFile(save_projects_xml, xmlStr);
}
}
So what I need to know is how do I capture the value of new_project_window.project_name.text, set it as its own global variable and pick that variable up on the following frame.
Any clues how to do this? Any help greatly appreciated.
Thanks
JMR
*
[CS3, AS2] Call Function And Pass Variable To Flash
I am using frameset in my main.html page to create two frames(frame1.html and frame2.html). In frame1.html, I am loading my swf and in frame2.html i am loading some other html page. I want flash to be able to call a javascript function which i have in the <head> of frame1.html.... So once this javascript function is called it pushes variables into my flash file
How Do I Pass A Variable To A Function From An Event Listener
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);
var ButtonInstanceName = "button_"+ (j+1) + "_btn"; // button Instance name
// How do I pass the variable j to the Button_Click function
// Calling the function works fine without passing the variable just how do I pass it the variables
this[ButtonInstanceName].addEventListener(MouseEvent.CLICK, Button_Click);
j+=1;
}while (j<=(number_of_links-1));
}
function Button_Click(myevent:MouseEvent):void{
trace(j)
}
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?
Thanks
Pass Variable Function In Function
I'm counting how many elements are are in my XML tree and then adding a button and changing the postioning. I can load the info in perfect, but when I try and pass the color variable to the button function things start to screw up.
PHP Code:
var theXML:XML=new XML();
theXML.onLoad = function()
{
buttonx=10;
nodes=this.firstChild.childNodes;
//trace(nodes.length)
for(i=0; i<nodes.length; i++)
{
newname="button"+i;
_root.mc5.attachMovie("button", newname,20+i);
_root.mc5[newname]._x+=buttonx*i;
new_color=nodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
newname="button"+j;
mc5[newname].onPress = function (new_color)
{
end_color=int(new_color)
doBlend = 1;
set_interval=setInterval(interval_function,1);
return end_color
}
}
}
theXML.load("xml.php");
I'm totally stumped. Any ideas?
Call Function, Pass Value, Access Variable In Movieclip Class From Main Stage
i am new to flash as.
I got quite confused on some problems. as the function here is quite different from c and asp.net.
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.*;
public class MC_Rectangle extends MovieClip {
var sequence:int = new int();
function setSequence(data:int):void{
sequence = data;
...
}
function addSequence():void{
sequence ++;
...
}
...
}
}
I have new a object in the main stage var mc_rect:MC_Rectangle = new MC_Rectangle()
question:
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?
thanks in advance.
Pass Variable To Custom Function Not Working In Flash MX For Flash 6 Player
I have a Flash application that I built in Flash 5 that I want to now output in Flash MX (not 2004, though) for Flash 6 Player. The problem is that part of my code, which works fine if published for Flash 5 Player, breaks if published for Flash 6 Player. I am loading text from an external text file, and then passing the text contents of each variable to a function (to strip line breaks). Following is the code... does anyone know how to rewrite this so that it will work as Flash 6 Player swf? The contents of the variable are not getting passed, and eval does not work on left side of expression... I've tried everything I can think of...
Thanks in advance for help.
-S
PHP Code:
/* content, correct, Q1, Q2, Q3, etc are all variable loaded from external text file. I am trying to pass contents of variables, which is why I need to eval them. This worked in Flash 5, but not in Flash MX if I publish as Flash Player 6 file. */
temp = stripLineBreak("content");
temp = stripLineBreak("correct");
for (i=1; i<=10; i++){
z="Q"+i
temp = stripLineBreak(z);
}
function stripLineBreak(x) {
tempArray = new Array();
tempArray = eval(x).split("
");
eval(x) = tempArray.join("");
tempArray.splice(0,tempArray.length);
tempArray = eval(x).split("
");
eval(x) = tempArray.join("");
tempArray.splice(0,tempArray.length);
}
[F8] How To Pass Paramters Of A Function To Another Function
THis is what I have:
function assignFunction(mclip, func){
mclip.onRelease = func;
}
function foo(var1, var2){
trace(var1);
trace(var2);
}
assignFunction(button1, ??????????)...
So how do I do this? I tried:
assignFunction(button1, foo(x,y));
and it didn't assign the foo function to the onRelease event.
Can I Pass A Function Reference To Another Function?
Hello,
Basic background:
I am trying to create a custom preloader class that uses a Array to store a queue of URLRequest objects, to be loaded in order. I don't have any problems with the queue or getting the loader to load the URLRequests in order.
I can't seem to pass a reference to a function (think address of in C) into my preloader class. I want to pass said function reference to serve as the event listener for the given URLRequest.
Function signature:
public function addItemToLoad( item:URLRequest, notify:FUNCTION_REFERENCE)
Does anyone know what the syntax is for passing the address of a function to be called at a later time?
Think
FunctionName
vs
FunctionName()
Thanks,
Nomadic Design
Edited: 03/11/2008 at 10:33:15 AM by NomadicDesign
Pass Function Parameters In Another Function
Hi guys!
I have a timer and I want to call a function once the interval I set expires, pretty standard.
But when I also want to pass a couple of extra arguments with the Timer parameters.
Code:
var timer:Timer = new Timer(500, 10);
var X:Number = 10;
timer.addEventListener(TimerEvent.TIMER, notifier[pass extra args here]);
// now I want to send this number X to the notifier function.
function notifier(event:TimerEvent, var total:Number = 0):void {
trace(timer.currentCount);
trace ("total: " + total);
}
timer.start();
This is only a snippet. I want to know how I'm to pass the extra arguments to the function.
Thanks in advance!
Pass Function Name To Function And Call
bit stuck on this.
any help much appreciated!
ActionScript Code:
func_1(mc10, 'func_2',[id1, add]);
function func_1(tofade, oncompletecall, var){
//fade out 'tofade'
//then call oncompletecall(func_2) function..
how do i form the call to func_2?
}
function fun_2(id1, add){
do something...
}
Can't Seem To Pass This Value To A Function
spent 2 hours on this, god knows what I'm doing wrong
Trying to build a function to access a certain frame of a certain movieclip mcB inside another movieclip mcA, this is what I've got:
function crap(whichMC,frame){
whichMC.gotoAndStop(frame);
}
frame = "red";
whichMC = "mcA.mcB" add "1";
crap(whichMC,frame);
now that doesn't work, if I hardcode that value for "whichMC" and do:
function crap(whichMC,frame){
whichMC.gotoAndStop(frame);
}
frame = "red";
whichMC = mcA.mcB1;
crap(whichMC,frame);
..it works fine
I've tried every combination using quotes, non quotes "add" "+" but whatever I do it won't understand "whichMC" unless I hardcode it as above.
Be extremely grateful for any help on this!
Pass Value To Function
I'm having trouble passing a HEX value to my function:
code: HEXtoRGB = function(hex){
return {r:hex >> 16, g:hex >> 8 & 0xff, b:hex & 0xff};
};
col = HEXtoRGB (_root.bgColor);
colr = (col.r);
colg = (col.g);
colb = (col.b);
If I hardcode 0x3366CC for example (in place of _root.bgColor) it works fine.
However, I'm embedding the bgColor value in my html code (movie.swf?bgColor=0x3366CC) and I get 0 results. And mysteriosuly, if I use movie.swf?bgColor=3366CC I get some 2 digit results.
Is it possible to pass a variable to my function, in this way?
Pass Value Through Function
Hello!
I need help… very basic stuff but I'm new to AS3, so I get pretty messed up
I'm trying to pass a variable named themeColor with contains a string taken from an XML element called "color". How on earth do I do that?
(themeColor isn't a global variable)
This is how I call the function:
PHP Code:
menuTitle.addEventListener(MouseEvent.MOUSE_OVER, themeColor, menu01.mouseHover);
This is the function:
PHP Code:
function mouseHover(event:MouseEvent, x:String):void{ colorInfo.color = x; rect45.transform.colorTransform = colorInfo;}
Please help.
Thanks,
rwt
Can't Pass Variable
Hi,
I have a movie where I define a variable "botsim=20" in one of the first frames. Then, later in the movie I want to call this variable from a movieclip timeline by using it in something like "john=botsim+5". However the movieclip hasn't been able to call the "botsim" variable. Is it not possible to pass a variable from the movie timeline to a movie clip timeline?
Dan Riley
Variable Pass
Hi
I have several drag and drop movie clips which ask the User to place coded books (Dewey referencing code) onto numbered targets on a bookshelf.
I can program the movie so that it can check how many items are in the correct sequential order and gives the user three chances to get it right before loading the next movie clip.
What I am *desperate* to know is ... how do I keep a running score of correct attempts to be displayed at the end of the movie sequence?
*Any* suggestions would be appreciated ... I just need to carry the score from movie to movie (I think???)
--Rhi~
Pass Variable From JS To AS
Please Help!
Does anybody know how I can pass a variable from JavaScript to ActionScript (getVariable?)!
THX
Can't Seem To Pass A Variable Into Another Mc.....
Hey,
I'm experiencing a peculiar little variable problem:
I have a button:
Code:
on(release){
WinName = "lea";
_root.attachMovie("Gallery", WinName,559);
_root[WinName]._x = 200;
_root[WinName]._y = 200;
_root[WinName].ModelName = "lea";
this.NumThumbs = 5;
for (i=this.NumThumbs+1; i<=16; i++){
_root[WinName]["Thumb"+i]._visible=0;
}
}
this is the line i'm having trouble with:
_root[WinName].ModelName = "lea";
the "Gallery" clip attaches itself properly and receives this variable. And then the peculiar behaviour starts.
on the top layer, i use that variable to fill a text field. This works.
the layer below that, i have a movie clip which contains a button. the movie clip as:
Code:
onClipEvent(load){
this.ThumbNumber = 1;
this.ImageNumber = "01";
trace(ModelName);
}
the trace on ModelName comes up as undefined. I can't do a full path reference to the variable because the instance name of the clip is the same as ModelName.
it does work if i make ModelName a global variable, but that messes up the rest of the movie.
Any suggestions?
Cheers,
Ben
Pass A Variable
I have a button on a index.swf on level 1. I want this button to load awards.swf on level 2 and send a variable to awards.swf so that it opens at a certain point in a scrollable text.
I can get this to work if the variable value is set in awards.swf. Is it possible to send a variable value across different movies? If so, how.
Thanks
Robert
Pass Variable From One Swf To Another
hi
Well i am making a cd presentation in flash ...
i have 4 main movies(swf) with sound clips each has a mute button... if the mute button is clicked its stops sounds and passes a variable _root.check="off" ... but when i click on the link to other movies its gets enable again and the sound starts playing again ... i want this variable i.e _root.check to pass accross all the movie i click.
which means if i have click the mute button all the other swf files or movies i load should be muted...
please help me soon.
regards
kapil
ps deathline is tomm..
How Do I Pass A Variable From...
..the main timeline to a loaded movie clip.
Layout: Main timeline contains audio voice over. Keyframes swap the value of silent from 0 (talking) to 1(not talking).
Movie clip is an 4 keyframe, 8 frame movie made to loop randomly. Frame 1 contains the mouth not talking, frames 3,5 and 7 have the mouth in various vocal positions (2 frames each mouth position).
In each frame of the movie clip I have the following script:
while (_level0.silence==0) {
var mouth=Math.round(Math.random()*3)
gotoAndPlay((mouth*)+1);
}
gotoAndPlay(1);
When I test the movie, I get an error message "A script in this movie is causing your computer to run slowly. Abort this script?"
Upon aborting the movie clip plays, but looping sequentially.
How can I fix this?? Tell me this is an easy one....
Boy, Do I Need To Pass A Variable
Okay~
so I started messin with the "menu dropdown" file included in Flash MX. Its the nice vertical heirarchy navigator with clickable entries. Its all controlled via an .xml file.
What Id like to do to make the interface more user friendly is to have it not collapse the menu items upon reload.
Each time the user clicks a link it reloads the .swf and effectively closes the section the user was looking at.
Macromedia uses this interface and theirs seems to remain open through page loads...anyone know how?
The link above is what Im working on. Its not complete so dont flame me for dead links, or errors.
Doug
Pass Variable Value From One Swf To Another
I have two swf's 1 and 2 and I want to pass a variable value from 2 to 1 while I load 1 over 2 in _level0.
Here is the code:
button in swf 2:
on (release) {
loadMovieNum ("miramarcd1.swf", 0, "GET");
}
variable in _root.main in swf 2:
from2=1;
actions in _root.main in swf 1:
if (from2) {
_root.main.slideshow.gotoAndStop(10);
}
What I am trying to accomplish with this code is when I press the button in swf 2 I load swf 1 in _level0 thus replacing swf 2. While doing this I want to pass the value of variable "from2" in swf 2 to swf 1.
This doesnt seem to work.
I Need To Pass A Variable From One To Another
I have an .swf with a few buttons. each button pops open a new html page with another .swf embeded in it. depending on which button is pushed, i need to pass a variable from the original flash file to the one that opens in the new window. I'm assuming this requires some javascript. can someone give me an example of how I can pass information from one flash file to the other? Thanks guys ...kuramu
Please Help Me Pass A Variable
I have an .swf with a few buttons. each button pops open a new html page with another .swf embeded in it. depending on which button is pushed, i need to pass a variable from the original flash file to the one that opens in the new html window.
I was trying the "myFile.swf?myNumber=26" thing to get the variable from html to the second SWF, but how do I use the first flash file to set that variable? Thanks
Pass Variable To PHP ?
Hi,
I want to know how to pass variable from Moive clip to PHP , I have a input text field inside the movie clip named "input" . i cant pass this variable to php ,if i put this field at root level (outside movieclip) it works fine .
please anyone know how to do it ,please help me
Thanx
Shan
Variable To Pass MC Name?
Im not sure what Im missing here or why I cant seem to target my MC's correctly..
but I have a few MC's on my stage...
example: frame_mc & tank_mc
They have this code inside of them:
Code:
stop();
this.onPress = function() {
this.startDrag();
focusClip = "tank_mc";
trace("focusClip is tank_mc");
};
this.onRelease = function() {
stopDrag();
};
and
Code:
stop();
this.onPress = function() {
this.startDrag();
focusClip = "frame_mc";
trace("focusClip is frame_mc");
};
this.onRelease = function() {
stopDrag();
};
Now I want to have some buttons rotate (and another set scale both x & y) the "focusClip"
But I cant seem to target it...
on my button I have this code:
Code:
on (press) {
focusClip._rotation += 5;
}
and
Code:
on (press) {
_root.focusClip._rotation += 5;
}
when I target by their individual instance names..they buttons work...however I would need a new set of buttons for each movie clip I click on...where I can just change the variable and use one set of buttons.
can anyone help??
Thanks
Pass Value To Variable
I don't know how to explain this in any easy way so please bear with me and sorry for the long text.
I'm creating a webpage where all the content is within the same swf. In order to get things to work I have all my different content in different MC's. Each of those separate MC's have two frames inside. One where it's empty and the other where the content is displayed. To make this work I have a variable name 'page'. My menu is supposed to pass a string to this variable and at the same time trigger a transition to be played ('doors' sliding over and hiding the stage). Then the transition sets all my content MC's to the hide position. Then it checks what the page variable is and sets the corresponding content MC to show before the 'doors' open again. At least that's how it's supposed to work in theory. But I haven't figured out how to do all this. First off I don't know how to get my menu to pass that string to the 'page' variable. Here's my menu with the problem area marked:
code:
stop();
// link variables
var urls = ['hjemFrm', 'guttaFrm', 'sponsorFrm', 'bussenFrm', 'http://gjestebok.nuffe.net/11668'];
// Button labels
var labels = ['HJEM', 'GUTTA', 'SPONSOR', 'BUSSEN', 'CHAT'];
for (var i = 0; i<labels.length; i++)
{
var btn = this['l'+i+'_btn'];
var mc = this['l'+i+'_mc'];
mc.textLabel.text = labels[i];
btn.defaultPos = mc._x;
btn.id = i;
// assign a lnk variable from the urls array
btn.lnk = urls[i];
btn.onRollOver = function()
{
var mc = this._parent['l'+this.id+'_mc'];
mc.targetx = this.defaultPos+9;
mc.dx = 3;
mc.onEnterFrame = moveMe;
};
btn.onRollOut = function()
{
var mc = this._parent['l'+this.id+'_mc'];
mc.targetx = this.defaultPos;
mc.dx = -3;
mc.onEnterFrame = moveMe;
};
btn.onRelease = function()
{
if(this.id==4)
{
getURL(this.lnk);
}
else
{
// PROBLEM !!!!
page(this.lnk);
}
}
}
function moveMe()
{
if (this._x == this.targetx)
{
delete this.onEnterFrame;
}
else
{
this._x += this.dx;
}
}
The other problem is, how do I get my menu to do nothing if it is on the page which button was clicked. The rest I think I might be able to do but if anyone wants to spell it out for me it would be grately appriciated. thx in advance guys.
Pass A Variable From An Swf To Another One
Hi
I'm Marco.
I have an html page named home.html; it embeds a flash movie named "1.swf "; When I click a button inside 1.swf :
--the variable "section" gets a value, for example section=1;
--this button links to another html page "main.html"
The main.html embeds a flash movie named "2.swf";
I would like that 2.swf gets the value of the variable section from the button clicked from 1.swf, which now is section=1;
how can I do it?
thanks
marco
[F8] Pass A Variable From Url
Hi,
Is it possible to use cutomized urls to create a personalized message within a flash movie? For example, lets say I send out a direct mail piece with a specific url for each customer (www.myurl.com/customer1) When they go to that url I want to pass that info to the flash movie so I can display a message like "welcome to my site customer 1, I'm glad you found us..." Any tips and pointers you can offer would be great!
Thanks in advance!
Pass Variable Name?
hi,
Anyone know of a way to pass or retrieve a given variables name?
example:
Code:
// myVariable is the thing to watch...
var myVariable:String = "variable value";
function displayVariableName(s:String){// here I get the value:
trace(" variable Value: "+s);// result: "variable value"
// here I would like to see the actual name of the variable passed:
trace(" variable Name: "+???); // would be: "myVariable"
}
// I pass the var to the function...
displayVariableName(myVariable);
I understand that I could make a function call of:
Code:
displayVariableName(myVariable,"myVariable");
but that's not what I'm after...
...any ideas?
thanks for any help.
Can I Pass A Variable From One Swf To Another?
Loader1.swf (var nav: is instantiated)- at the end of this it loads Loader2.swf.
Loader2.swf has 2 buttons. OnRelease of either here is what happens:
on(release){
nav="guyNav";
play();
}
then this is on the last frame:
loadMovie("loader3.swf", "_level20");
stop();
Loader3.swf has this on the first frame:
attachMovie(nav, "mainNav", 21);
mainNav._y=563;
So basically I need to attach a mc from Loader3.swf library and that mc is based on which button is hit in Loader2.swf.
Cant get it to work...is this possible. I have also tried many things like
_level20.nav="guyNav";
Loader3.swf.nav="guyNav";
_root.nav="guyNav";
can this even be done?
How To Pass Variable From MC To ASP
I have no form on flash but I am trying to extract color of some images on my flash movie and send it to ASP and database. When someone clicks on that movie it fills new color. I have extracted the color value by using getRGB() I have used Trace to see these values in output window.
Now how to send these values in ASP page so that I can put it into database?
Any help will be appricaited.
Pass URL Variable In And Out Again
Hi There.
I only started using flash a few days ago so this is obviously my first post.
Pass URL variable in and out again
I have built a banner ad manger system and it works fine with images, it basically
counts how many times the banner has been displayed and how many click thru's etc.
Now I am trying to develop it for Flash as well. I have done 90% and all is well. I have one
major stumbling block though.
I am passing in this variable <embed src="banner_ad.swf?BannerId=#BannerId#"
The banner will be displayed and the view added to the database so far now once the banner
is displayed it will have a url to the site it is advertising, problem is that the url
needs to be dynamic so I can count that it has been clicked on.
So in the nutshell the user clicks on the (Flash) banner it goes to a cold fusion page that updates
the database according to the BannerID coming from the flash banner, then it re-directs them to the
advertisers site.
I have this from what I have learnt in a few short days but it does not work.
EXHIBIT A:
on (release) {
getURL("index.cfm?fuseaction=display_redirect&esc= 1&BannerId=" + BannerId,"_blank");
}
Note: BannerID comes from the intial variable passed in to the flash movie
What my goal is is to have the link
index.cfm?fuseaction=display_redirect&esc=1&Banner Id="Variable Passed In" and _blank
Exhibit A is working but it only returns, the root of the site and the BannerID variable
I am losing everything from index to BannerID=
I GET: http://server/site/main/6
Can someone enlighten me please - in the mean time I will keep scouring and searching for the answer.
Cheer and thanks in advance - Garry
Pass Variable From One SWF To Another SWF
I am having difficulties passing a variable from one SWF to a dynamically loaded SWF.
I can get variables to pass into a SWF while using FlashVars in HTML. But in this case, I need to load the SWF file into another SWF file instead of directly via an HTML page & FLashVars. So now I can't figure out how to pass a variable from my main SWF file another SWF file.
// testA.fla AS code:
myText_txt.text = testVar; // this would display whatever I pass it when using FlashVars to set testVar in HTML
// testB.fla AS code:
this.createEmptyMovieClip("holder_mc", 0);
holder_mc.testVar = "Does this show up?"; // it doesn't show up
holder_mc.loadMovie("testA.swf");
//holder_mc.loadMovie("testA.swf?testVar='some thing i want to pass'");// doesn't work.
Any insight is appreciated!
Trying To Pass A Variable
I'm trying to pass the value picked from the color picker to a text field. I am attaching the .fla...
you will see that when you click on the color picker, it sets the color of the mc... I also want it to set the variable fcolor when picked.
the swf can be viewed at http://www.aulman.com/mxdab/ford0.html
if you just want to view the file first... the text down below should change to the hex # when picked...
Any help is appreciated...
Rev
<a href ="http://www.aulman.com/mxdab/ford1.fla"> fla here </a>
[MX] Pass Variable From 1 Swf To Another
Hello,
I have 2 SWF's on my website. They are separate though - not using loadmovie. I'd like to have my first SWF play and then trigger the 2nd SWF to play when the first one is done. How can I pass a variable from the 1st SWF to the 2nd? Is this possible?
Thanks
Foo
How To Pass Variable?
hi, I want to pass a selectedIndex as a variable over to another function so that the loop will follow whatever is being selected in the list.
I've tried using return variable;
it doesn't seem to be working though
I would like to loop the images in the following function by following the 'count' variable from the video playback.
for (var q=0; q<total; q++) {
image[q] = xmlNode.childNodes[count].childNodes[1].childNodes[q].firstChild.nodeValue;
image3[q] = xmlNode.childNodes[count].childNodes[2].childNodes[q].firstChild.nodeValue;
messages[q] = xmlNode.childNodes[count].childNodes[3].childNodes[q].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
This is the video playback loop. Is it possible to loop the above image slidesshow function using the index of the video? Such as When video 1 is playing, I use the video index of 1 for the image slideshow to know which image it should show.
vidList.complete = function() {
if(seq.selected) {
if(count == list.length-1){
count = 0;
}
else {
count++;
}
}
else {
var temp = count;
while(temp == count) {
count = Math.floor(Math.random()*list.length);
}
}
vid.play(list.getItemAt(count).data);
list.selectedIndex = count;
list.getSelectedIndex();
trace(count);
}
really appreciate any help here. Thank you.
Want To Pass A Value To Variable...
init;
function init()
{
vx = x;
ball = attachMovie("ball", "ball", 0);
ball._x = 0;
ball._y = Stage.height / 2;
}
Using the above script i want to get the value from asp page and use for x using loadVariables().How its Possible...Please anybody give a immd solution...
Gnanavel
How Do You Pass A Variable
Ok so I have a movie clip, and have duplicated it to the stage many times. I gave each instance of the clip a different yet similar name, like so: row_0_0, row_0_1, row_0_2, row_1_0, row_1_1, and so forth. I'm only have a the problem of getting the variable that holds the each clips name to pass to become an object. here's the code. The code is on the each instance of the movie clip. thanks
Code:
stop();
var block:String;
var row;
var col;
this.onRelease = function() {
var nameArray = this._name.split("_");
for (var x = -1; x < 2; x++) {
for (var y = -1; y < 2; y++) {
row = parseInt(nameArray[1]) + x;
col = parseInt(nameArray[2]) + y;
if (row >= 0 && row <= 6 && col >= 0 && col <= 6) {
block = nameArray[0].concat("_", row, "_", col);
block.gotoAndPlay(2);
}
}
}
}
Variable Pass By Value
Hello,
I'm trying to take variables from an external php file and load them into flash. I got most of it working, however i'v ran into a few issues with passing my variables around.
First I declare my global vars on the first keyframe:
Code:
onLoad()
{
_global.thedata = new Array();
_global.anum = 0;
}
Then I run my copy function
Code:
onEnterFrame()
{
getdata();
sites_txt.text = _global.thedata[1];
}
Code:
function getdata()
{
l = new LoadVars();
l.onLoad = function()
{
for(i=0; i<15; i++)
{
_global.thedata[i] = this["result"+i];
}
}
I am able to confirm that the output from this["results"+i] is correct. I'm also able to check its entering the array _global.thedata[i] correctly (if I run some test after the for loop). However, in its current form setting the text box with the value of thedata[1] (after getdata() function) doesn't appear to be working. All I get is a clear input or sometimes an undefined. Could it be that _global.thedata[i] = this["result"+i]; is passing by reference, thus when the function scope deallocates, the original variables are deallocated with it. Is there a way to pass-by-value? or is there something else i'm missing.
Please come be my Link!
Thanks!
|