Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Variable Transfer Control?



Sorry this is somewhat relating to php as well as actionscript. I have been through nearly every flash/php/mySQL tutorial on the internet at this point and need some help if its at all possible, here is my dilema.

I have an swl that has an interger loaded to its _root via flashvars in the embed tag. I pass this number to a php script like this....

Code:
getURL ("http://www.mysite.com/myfile.php", "POST");
I can "echo" the passed variable in the php script no problem, so it IS getting sent.

The next frame has a movie clip with the following code attached....

Code:
onClipEvent (load) {
loadVariables("http://www.mysite.com/myfile.php", this, "GET");}
This works great as well, and I can sucessfully pull the information from the php script. However I need the SWF to wait until the flashvar is sent before it tries to get the results from the php script (via loadvariables).

The php script is like this, I summarized it down though....

Code:
<?PHP
$id = $_POST["id"]; //to get the flashvar being passed

//here it processes $id with my SQL database
$something = $id;

print "something=$something";
?>
How can I tell flash to wait until the POST method is sent 100% before it starts trying to get the results from the php file's print? I know that loadvars class has some onload functions but there is little documentation that I could find.

So I guess I need a way for the two (swf and php) to take turns sending data,
I appreciate the help greatly,



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 01-11-2007, 10:24 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Php Variable -> Actionscript Variable (transfer Without Being Seen By User)
I am trying to secure up the sign up process with something similar to the "type these 6 letters"

the problem is, how to get a value between php(or any server-side language) and actionscript? I only know ways where the variable would be visible to a robot, rendering this extra sign-up step useless.


So I am wondering if there is a way to transfer a variable without it being seen during transfer?

I have a little bit of knowledge about public variable encryption and I know it would work for this but i have never implemented this encryption before. Is there a tutorial that shows how to go about creating a public encryption/decryption algorithm?

Unable To Transfer Control (if Problem)
Hi i am trying to do a flash website which looks different at different time of the day, say morning, afternoons & nite.

I have an asp page which send me the value of 1/2/3. Now i load this value in flash, but I am unable to shift the control to the respective frame, I think my if statement is not working.

The code on the first frame is.
----------------------------------------------------

rand=Math.round(math.random()*100000);
loadVariables("timeval.asp?i="+rand,"");

if (chkval == 1) {
    gotoAndPlay(5);
}
if (chkval == 2) {
    gotoAndPlay(6);
}
if (chkval == 3) {
    gotoAndPlay(7);
}

------------------------------------------------------

where chkval is the name of the variable on the asp file.
the value asp returns will be &chkval=1 / &chkval=2 / &chkval=3.

I had even tried assigning chkval to another variable, but nothing seems to work.

I am able to get the value, but the if statement is not working.

I am using FlashMX2004. Someone plz help me...

Thanx in advance...

Regards,
Tommcat

Check Variable Transfer
Hello,
you know that sometimes the variables are passed via GET or POST. When they are passed via GET, the variables are visible in the query string. I use this to send variables from Flash to sites via LoadVars. For example, if I see that there is a variable like http://www.site.com/index.php?foo=bar I know which vars I have to pass, like this:

var l:LoadVars = new LoadVars();
l.foo = "bar";
l.send("http://www.site.com/index.php", "GET");

I get the HTML and do some tricks with it.

Ok, so far so good. But what about variables that are sent via POST? I do not know the name of the var, that's the problem.
The problem applies to ASP and PHP as well. How can I find out what variables are passed to the script via POST???

Thanks in advance.

Regards,
Mirza

[MX04] Variable Transfer Issue
Alright, I have been through nearly every flash/php/mySQL tutorial on the internet at this point and need some help if its at all possible, here is my dilema.

I have an swl that has an interger loaded to its _root via flashvars in the embed tag. I pass this number to a php script like this....

Code:
getURL ("http://www.mysite.com/myfile.php", "POST");

I can "echo" the passed variable in the php script no problem, so it IS getting sent.

The next frame has a movie clip with the following code attached....

Code:
onClipEvent (load) {
loadVariables("http://www.mysite.com/myfile.php", this, "GET");}

This works great as well, and I can sucessfully pull the information from the php script. However I need the SWF to wait until the flashvar is sent before it tries to get the results from the php script (via loadvariables).

The php script is like this, I summarized it down though....

Code:
<?PHP
$id = $_POST["id"]; //to get the flashvar being passed

//here it processes $id with my SQL database
$something = $id;

print "something=$something";
?>

How can I tell flash to wait until the POST method is sent 100% before it starts trying to get the results from the php file's print? I know that loadvars class has some onload functions but there is little documentation that I could find.

So I guess I need a way for the two (swf and php) to take turns sending data,
I appreciate the help greatly,

Variable Transfer Coldfusion > Flash
I am attempting to transfer variables from this Cold Fusion script:
<cfsetting enablecfoutputonly = "yes">
<cfprocessingdirective suppresswhitespace="Yes">
<cfset Name = "Stranger" />
<cfoutput>welcomeMessage=#Name#</cfoutput>
</cfprocessingdirective>

Variable Transfer Coldfusion > Flash
I am attempting to transfer variables from this Cold Fusion script:
<cfsetting enablecfoutputonly = "yes">
<cfprocessingdirective suppresswhitespace="Yes">
<cfset Name = "Stranger" />
<cfoutput>welcomeMessage=#Name#</cfoutput>
</cfprocessingdirective>

Variable Transfer Coldfusion > Flash
I am attempting to transfer variables from this Cold Fusion server script:

<cfsetting enablecfoutputonly = "yes">
<cfprocessingdirective suppresswhitespace="Yes">
<cfset Name = "Stranger" />
<cfoutput>welcomeMessage=#Name#</cfoutput>
</cfprocessingdirective>

into this Actionscript3 Flash file:

var loader:URLLoader = new URLLoader()
loader.addEventListener(Event.COMPLETE, nextitem)
//navigateToURL(new URLRequest("CFM/test.cfm"), "_blank")
loader.load(new URLRequest("CFM/test.cfm"))
stop()

function nextitem(event:Event):void {
testTF.text = "HERE"+URLLoader(event.target).data
}

When I do a Test Movie from Flash the first line of the Cold Fusion file is displayed. When I open the Flash file in my browser, no data is displayed (if I replace data with bytesTotal, a 0 is displayed). I have tried everything I can think of including reinstalling my flash palyer, but have not been able to solve this problem. Does anyone have a suggestion?

Control A MC With A Variable
Hopefully this is quite simple,

I have a movie clip and three buttons.

All the buttons will play the movie clip until the first stop action is reached.

But

If the movie clip has been played to that stop action i want the button to know this and jump to another part of the movie clip when clicked.

I would like to know how to do this using variables - as the play command alone is not quite suitable,
any tutorials would be great also, thanks all

I Set A Variable But Can't Control It,please Help
hello,

I have a fla with 150 frames.
I set a variable at frame(0) like

d=0

and choose a special frame and I pasted this code to the frame:

d=d+1;
if (d==4) {
gotoAndPlay("anyframe");
}

I put a button on the main screen and when I click button the movie goes to the special frame,which I pasted the code.But when I click the button 4 times,the movie doesn't go to "anyframe".What am I doing wrong?

Thanks for your time.

Control With Variable
So far no luck in figuring this out. Have been trying for days. what I have is a button I have made into a movie clip and on this button is this AS.

onClipEvent (load) {
if (_root.button1 == "on") {
this._visible = 1;
} else {
this._visible = 0;
}
}

then in frame one of the main time line I have this.

button1 = "on";

This works I can manuly go in there and change that to off in the action script window and then you don't see the button.
What I want to be able to do thoe. is have a txt file loaded from my server that says on or off and then the button/movieclip read that and either be visiable or invisiable according to what is brought in by the txt file. I have tried just putting a input and a dynamic txt box on the main timeline and changing it there but it is not working. What am I leaving out in this??

Variable Control
using this code on an MC to follow my cursor:

onClipEvent (load) {
_x = 0;
_y = 0;
speed = 5;
}
onClipEvent (enterFrame) {
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}


what i want to do is stop the follow on a button press, but i can only do it by upping the var value:

but1.onPress = function ()
{
speed=100000000000;
};

i know there must be a better way to do this?

rat

Using Variable To Control Mc
i have a series of invisible buttons over mc's controlling them to make up rollover, rollout and 'on' states. this works fine.
on release i set the corresponding mc to stop at a certain frame and turn off the invisible button above it (so it's not clickable). i'm also using 2 text fields as variables to allow on release to display which button is in the 'on' state and which invisible button is off. this all works ok but i don't know what code to put in my buttons to tell them that on release they should play the outro (from frame 11) of the current active mc and turn the invisible button back on again. here is my code so far:

on (rollOver, dragOver) {
homeBtn.gotoAndPlay(2);
}
on (rollOut, dragOut) {
if (But1._visible == 0) {
homeBtn.gotoAndStop(10);
} else {
homeBtn.gotoAndPlay(11);
}
}
on (release) {
this.But1._visible = 0;
homeBtn.gotoAndStop(10);
activeinvisButton_btn._visible = 1;
activeButton+"_mc".gotoAndPlay(11);
activeButton = "homeBtn";
activeinvisButton = "But1";
}

get me? its these bits that don't work:

activeinvisButton_btn._visible = 1;
activeButton+"_mc".gotoAndPlay(11);

Variable To Control MC?
HELLO, and thanx for readin my post.

I am trying to have a variable referring to a MC property(alpha).
For example, how can I make this possible?

e.g.

var pID="p3";

_root.pID._alpha+=10;

Right now, this don't work.. when I trace it, it just says
pID = "undefined"

Any suggestions will be appreciated!

How To Control A MC According To Its Variable
I have several MCs, each one with a different _name.


when a Mc is clicked a variable is defined to it. Like:

Code:
on (press){
_root.clicked = this._name;
}
Also have a function on the main timeline that will reduz the MCs scale, but not all the other MCs.
How can I make the function call the Mc according to its variable? (just scale the MC with the variable clicked == this._name.)

Hope have been clear enough.
Thanks for any help

Using Variable To Control Mc
i have a series of invisible buttons over mc's controlling them to make up rollover, rollout and 'on' states. this works fine.
on release i set the corresponding mc to stop at a certain frame and turn off the invisible button above it (so it's not clickable). i'm also using 2 text fields as variables to allow on release to display which button is in the 'on' state and which invisible button is off. this all works ok but i don't know what code to put in my buttons to tell them that on release they should play the outro (from frame 11) of the current active mc and turn the invisible button back on again. here is my code so far:

on (rollOver, dragOver) {
homeBtn.gotoAndPlay(2);
}
on (rollOut, dragOut) {
if (But1._visible == 0) {
homeBtn.gotoAndStop(10);
} else {
homeBtn.gotoAndPlay(11);
}
}
on (release) {
this.But1._visible = 0;
homeBtn.gotoAndStop(10);
activeinvisButton_btn._visible = 1;
activeButton+"_mc".gotoAndPlay(11);
activeButton = "homeBtn";
activeinvisButton = "But1";
}

get me? its these bits that don't work:

activeinvisButton_btn._visible = 1;
activeButton+"_mc".gotoAndPlay(11);

Help With Variable To Control Menus
Can anyone tell me, show me or point to any tutorials on using variables to control menus.

I have different windows that open for different sections, ie, 1 window for contact details and one window for products,etc. When one window is open and i click another button i want it to close any other windows that might be open and open the window related to the button i just clicked.

I'm sure u know what i mean. I found a tutorial on it ages ago but i cant find it now.

Variable Control Problems
variable problems

i have a movie('MY RANDOM.swf') that has an array loading movies into an empty movieclip, this movie('MY RANDOM')
is on level 3. within the arrayed movie button with a set variable: _level3.mtclip.current_selection = "sound";.
i would like this button to load 3 external movies if pressed (load movie1, then after movie 1 is loaded, load 2 & 3 ).
currently it opens one movie but the other 2 are a struggle.


this is the script i have for the frame with the variable:
_level3.mtclip.current_selection = "sound";

this is the script inside the button:

code:
on (release) {
_level3.mtclip.current_selection = "sound";
unloadMovieNum(2);
unloadMovieNum(3);
loadMovieNum("work_box_1.swf", 6);
}
}



this is the script in a frame in the first loaded movie (work_box_1.swf):

code:
// I also don't think i am setting the variable
correctly, if i am, i don't think i am addressing the variable with other movies correctly.

_level3.current_selection = "sound";
if (_level3.current_selection == "sound") {
//I want the script to say 'if "sound" button has been pressed, load the movies below
loadMovieNum("sound_box.swf", 9);
loadMovieNum("sound_box_low.swf", 10);
_level3.current_selection = "sound";
}


i cannot get this to work, please help.
thanks.

Variable To Control Movie
Howdy,

I'm trying to load a variable from an external source (text file) and what I had hope to do was that is the variable is greater then a certain value I would like the movie to play different section on the time line within a movie clip. Could anyone give me some advice to read the variable, I've been able to make the text display but all I really want to do is have the varaible determine which part of the movie to play.

Below is the snippet of the code I'm using, thanks in advance:


PHP Code:




loadVariables("count.txt", this);
if (COUNT>10) {
    gotoAndPlay(10);
}







123

Variable Control Problems
variable problems

i have a movie('MY RANDOM.swf') that has an array loading movies into an empty movieclip, this movie('MY RANDOM')
is on level 3. within the arrayed movie button with a set variable: _level3.mtclip.current_selection = "sound";.
i would like this button to load 3 external movies if pressed (load movie1, then after movie 1 is loaded, load 2 & 3 ).
currently it opens one movie but the other 2 are a struggle.


this is the script i have for the frame with the variable:
_level3.mtclip.current_selection = "sound";

this is the script inside the button:


ActionScript Code:
on (release) {    _level3.mtclip.current_selection = "sound";    unloadMovieNum(2);    unloadMovieNum(3);    loadMovieNum("work_box_1.swf", 6);    }}


this is the script in a frame in the first loaded movie (work_box_1.swf):


ActionScript Code:
// I also don't think i am setting the variablecorrectly, if i am, i don't think i am addressing the variable with other movies correctly._level3.current_selection = "sound";if (_level3.current_selection == "sound") {//I want the script to say 'if "sound" button has been pressed, load the movies below    loadMovieNum("sound_box.swf", 9);    loadMovieNum("sound_box_low.swf", 10);    _level3.current_selection = "sound";}


i cannot get this to work, please help.
thanks.

Variable Control Problems
variable problems

i have a movie('MY RANDOM.swf') that has an array loading movies into an empty movieclip, this movie('MY RANDOM')
is on level 3. within the arrayed movie button with a set variable: _level3.mtclip.current_selection = "sound";.
i would like this button to load 3 external movies if pressed (load movie1, then after movie 1 is loaded, load 2 & 3 ).
currently it opens one movie but the other 2 are a struggle.


this is the script i have for the frame with the variable:
_level3.mtclip.current_selection = "sound";

this is the script inside the button:


ActionScript Code:
on (release) {    _level3.mtclip.current_selection = "sound";    unloadMovieNum(2);    unloadMovieNum(3);    loadMovieNum("work_box_1.swf", 6);    }}


this is the script in a frame in the first loaded movie (work_box_1.swf):


ActionScript Code:
// I also don't think i am setting the variablecorrectly, if i am, i don't think i am addressing the variable with other movies correctly._level3.current_selection = "sound";if (_level3.current_selection == "sound") {//I want the script to say 'if "sound" button has been pressed, load the movies below    loadMovieNum("sound_box.swf", 9);    loadMovieNum("sound_box_low.swf", 10);    _level3.current_selection = "sound";}


i cannot get this to work, please help.
thanks.

Loading Variable From A Control Panel
Hi,
I have a piece of action scripting that moves an object via variables set>

onClipEvent (load){
dir = 45;
speed = 5;
}

onClipEvent (enterFrame) {
xspeed = Math.cos(dir*Math.PI/180)*speed;
yspeed = Math.sin(dir*Math.PI/180)*speed;
_x += xspeed;
_y += yspeed;
_rotation = dir;
}

I'm trying to load these variables via a control panel so that when the user puts in the speed variable and the dir variable and hits an enter button my object moves.

Can anyone pls help me with the control panel

Cheers,

CasOl

How Do I Control A MC Whose Instance Name Is Stored In A Variable?
I feel like such a noob.

I have duplicated a MC 30 times dynamically in level0. Basically, I have:

_level0.dot1
_level0.dot2
_level0.dot3
_level0.dot4
.....
_level0.dot30

sitting on the stage.

I have a script running on another movie clip that chooses one of those at random:

onClipEvent (enterFrame) {
randomDotValue = int(Math.random()*_root.totalDots+1);
_root.chosenDot = "_level0.dot"+randomDotValue;
}


This is successful in assigning one of the 30 instance names accurately to the variable _root.chosenDot.

Here is where I'm stuck...how do I get that particular movie clip to play? I can't, for the life of me, figure it out and it's aggrivating me! Help!

TIA
Steve

Trying To Retrieve A Variable To Control Animation
Using Flash MX 6
Both files are attached.

Thanks in advance for any help you can provide.

I have a .txt file with "&data=56" as my var.
I want to retrieve the variable and place it inside
a dynamic text box. "editbox"
The text box is part of a movie clip. "needleMC"
When the value 56 is retrieved and placed inside the editbox, it is also relayed to another dynamic text box (inside the same MC) to show speed. "speedBox"
The script works inside the Scene or _root no problem, but when I placed it inside a Movie Clip it stopped working???

Not sure what went wrong?

Also, would you happen to know if the Movie Clip could constantly check the "data.txt" file for changes and then update?


Thanks,

--Steve

Load Variable To Control Mc - Not Working
Hi

I have got a text file containing two variables

buttonstatus=ON
&tigertext=This is tiger text

I want these two variables to be displayed in dynamic text boxes. That is working fine.

But i also have a movie clip in my Flash which i want to move to the labels "ON" or "OFF" depending on whether the buttonstatus variable in the text file is "ON" or "OFF".

My actionscript is below. The text box bits are working. And the 'if else' code is working if I hardcode the 'buttonstatus="ON";' into my Flash file. But it won't recognise the dynamic version of it. Even though the buttonstatus variable is loading ok into the text box. There must be some simple syntax or global/local variable mistake I am making. Any help would be greatly appreciated!

code:

myData = new LoadVars();

myData.onLoad = function(){

_root.tigertext_txt.text = this.tigertext;
_root.buttontext_txt.text = this.buttonstatus;

if (this.buttonstatus == "ON") {
_root.tigerbuttonmc.gotoAndStop("ON");
} else if (this.buttonstatus == "OFF") {
_root.tigerbuttonmc.gotoAndStop("OFF");
}

}

myData.load("tigertext.txt");

stop();


Many thanks

[CS3] Control Clips With Variable Error
Well I'm a long time lurker of this great community, and I've been searching tutorials and forum posts all day and i finally have to post. so i really hope there isn't already a post for this, if there is please direct me.

here's my basic situation.

I haven't build a flash site since Tell Target days. I think i understand basic _root , _parent, This etc...

-Basically i have a menu on the left, and i want it to control a movie clip on the right.

-these are not on the main time line they are embedded within a few movie clips.

-When i use trace(eqv) to track the variable i want modified, it seems to be working...but i get a warning that says pretty much i wrote a crappy inefficient code and it takes my computer so long to figure it out. Flash then recommends i abort the script to prevent crashing

whats the best way to control this movie clip with my menu buttons

each button has this right now.

on (release) {

if (Number(eqv) == 1) {
eqv = 0;
} else {
eqv = 1;
}
}

basicaly i want the movie clip to play different parts of it depending on what button has been triggered. and if button one is clicked WHILE its content is already up. it will go away (eqv = 0 tells the move clip to go back to its start)

thank you so much if you took the time to read all that, let alone help me. cheers!

Using XML To Control Variable IF Conditions For Button
hi, i'm trying to do something I thought would be relatively simple...

I'm using a defined childnode in an external XML page to determine whether or not a dynamically loaded button should open in a new window(blow up the thumbnail) or do nothing at all.

I have the button tracing the "yes" or "no" state provided by the XML document just fine... but it's not actually working correctly.

Here's my script:

varWindow = (window[p]);
go_btn.onRelease = function() {
trace(window[p]);
if ((varWindow)="no") {
trace("don't open");
}else{
trace("open");
//getURL((links[p]), _blank);
}
};


It traces the "yes" and "no" just fine, but when it comes down to perform different actions based on the "yes" or "no", it does not differentiate the two. So i'm guessing the problem lies in my If...else condition... but for the life of me i cannot find it... and any help would be GREATLY appreciated!

thanks in advance!

-stephen

Flash: Variable Height Control
I am creating a site through flash with noscale, 100% height & width.

The content within the flash player varies throughout the site. Is there any way in which I can communicate with the browser and tell it to display a scrollbar?

See: www.genex.com
Click: Our Work >> By Service

I cant seem to find the answer to this anywhere. Any help is much appreciated.

Boolean Variable To Control MovieClip
Hi this is my first post so it would be great if someone could help.

i am trying to assign boolean variables to my script that i have made, basically i have never done it before so i have no idea how to add them to my script. i am controlling movieclips using alpha levels so when a key is pressed it makes a mc =100 and when the key is released it takes the alpha back down to 0. My mc work fine along with the keypresses, its just i need more control over what has already come up.

I want to use the boolean variables so that they control the mc and stop them from playing after a certain amount of times the key is pressed.
here is some of my script:

stop();
this.onEnterFrame = function() {
if (Key.isDown(65)) {
trace("It's an A");
girl_mc._alpha = 100;
} else {
girl_mc._alpha = 0;
}
if ((Key.isDown(85)) && (Key.isDown(65))) {
trace("It's a U and an A");
carnival2_mc._alpha = 100;
} else {
// if it's not down
carnival2_mc._alpha = 0;
}
if ((Key.isDown(85)) && (Key.isDown(65)) && (Key.isDown(84))) {
trace("It's a U, T and an A");
tree_mc._alpha=50, carnival2_mc._alpha=0, yo_mc._alpha=50;
} else {
// if it's not down
tree_mc._alpha=0, yo_mc._alpha=0;
}
if ((Key.isDown(85)) && (Key.isDown(65)) && (Key.isDown(84)) && (Key.isDown(79))) {
trace("It's a U, O, T and an A");
handy_mc._alpha=50, carnival2_mc._alpha=0, tree_mc._alpha=0, yo_mc._alpha=0;
} else {
// if it's not down
handy_mc._alpha = 0;
}
};

Variable To Control Actions On Other _level's
here's the scenerio, I have multiple movies that will be used several times in a website. rather than making multiple versions of each movie, I would like a variable in the _level0 movie to tell a mc in the _level12 movie what to do. I think its just a very simple IF statement but its just not clicking today.

Can't Use Variable To Control Object With Different Instane Name... So Strange
I am using flash 5 to create a game of lucky draw.
In the main stage, I have create several layers to host different thing, like 'draw' button, 'no. ball' (with number) which is one of the sybmol I creates for this movie and actions. And they are all in one frame. For the no. ball which is a movie clip, I have move 47 frames and each frame represent a number, e.g frame one with the number 1. on the ball... etc.

What I wanna to do is to put six 'no. ball' (with instance names b1, b2, b3, b4, b5, b6) in the same layer and then use the draw button to random a number and then use 'gotoandStop' to reach the frame of that random number inside the 'no. ball' movie clip. As there are six 'no. ball' clips, I allow the player to click the draw button six time in order to draw the number for b1, b2... b6 sequentially. When I put the following script on the draw button:

on (press) {
if (num_ball > 0) {
temp_array = new Array();
temp_rand = random ( 6 );
if (temp_rand == 0) {
temp_rand = 1;
}
temp_array[1] = b add temp_rand ;
obj_name = temp_array[1];
rand = temp_rand;
temp_array[1].gotoAndStop( temp_rand );
num_ball = num_ball - 1;
}
}


(p.s obj_name and rand are just two dynamic textfields for debugging)

no 'no. ball' clips responds. However, if I hard code temp_array[1].gotoAndStop( temp_rand ) to b2.gotoAndStop( temp_rand), I can make change to the 'no. ball' clips with instance name b2. So... can I use variable to decide which instance to change in this case? What's wrong with my clip?

HELP Movie Clip Sending A Variable To Control Another Mc
Hopefully someone can help with this menu I have created, I have uploaded the files here:

http://www.crayonmonkeys.com/help

What I want to happen is when the bouncy menu comes to a standstill, the menu selections should appear (epolitix.com etc)

When I click on the next button i.e Print I want the menu to go up then bounce down again then the print menu selections appear.

This is probably very easy but I seem to have flashers block there are 3 buttons and 2 movie clips

Thanks all

Crossdomain Variable / Script Control For Different Domains
i have been trying to figure out how to access and control one movie [loaded into _level5] from another movie [in _level0] when the movies are located on different domains....
..like mydomain.com....and otherdomain.com.

i tried the crossdomain.xml file.
it did not work.
here it is:

Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.otherdomain.com" />
<allow-access-from domain="otherdomain.com" />
</cross-domain-policy>
then i tried this actionscripting:
it did not work.

Code:
LC = new LocalConnection();
LC.allowDomain = function(sendingDomain) {
return (sendingDomain == this.domain() || sendingDomain == "otherdomain.com");
};
then i tried this actionscript:
it worked great!

Code:
System.security.allowDomain("www.otherdomain.com");
i am posting this so that it may help others and save them time.
i have testing it in player version 7 only at this time.
i would be interested in results in other players.
[edit]
this solution works just fine in player version 6 too.

Variable To Control Multiple Instances Of Text
Hi, right

i have a flash file where i'm using loadmovie to load in different swf files. at the moment i have to change about 5 instances of the name of the clips i'm using in the actionscipt for the loadmovie funcition. also i have to change the movie instance name. this is because i am just duplicating the previous one, then changing all the names.
i was wondering if there is a way i can just enter the text once and it will change all the other occurances on that actionscript.

so it would be something like this:

$e = [name of the file i want to load];
on (press) {
loadMovie("$e.swf", "_root.$e");
setProperty("_root.$e", _x, "0");
setProperty("_root.$e", _y, "0");
}

or could it just use the name of the instance name?

cheers

How A SWF Child Can Control A Parents Function / Variable ?
For instance, in the below code a parent can control a SWF childs function alert ().

But how a SWF child can control the parents function ReceivingChildMsg() ?

public class ChildSWF extends Sprite
{
private var t:TextField;

public function ChildSWF():void
{
t = new TextField( );
t.text = "No Message from the Parent";
addChild( t );
//~~~~~~~~~~
Button.addEventListener(MouseEvent.CLICK,clickHand ler,false,0,true);
}

public function alert(msg:String):void
{
t.text = msg;
}

protected function clickHandler(event:MouseEvent):void
{
ReceivingChildMsg (Received Child Message);
}


########

public class ParentSWF extends Sprite
{
private var loader:Loader;

public function ParentSWF():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, onLoadComplete);
loader.load(new URLRequest('ChildSWF.swf'));

//~~~~~~~~~~~
tc = new TextField( );
tc.text = "No Message from the Child";
addChild( tc );

}
private function onLoadComplete(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;

addChild(e.target.content);

var swf:Object = loaderInfo.content;

swf.x = 75;
swf.y = 50;

swf.alert('Received Parent Message');
}

public function ReceivingChildMsg ( var childsMsg:String):void
{
tc.text = childsMsg;
}
}

How A SWF Child Can Control A Parent’s Function/variable ?
For instance, in the below code a parent can control a SWF child’s function “alert ()”.

But how a SWF child can control parent’s function “ReceivingChildMsg()” ?









Attach Code

public class ChildSWF extends Sprite
{
private var t:TextField;

public function ChildSWF():void
{
t = new TextField( );
t.text = "No Message from the Parent";
addChild( t );
//~~~~~~~~~~
Button.addEventListener(MouseEvent.CLICK,clickHandler,false,0,true);
}

public function alert(msg:String):void
{
t.text = msg;
}

protected function clickHandler(event:MouseEvent):void
{
ReceivingChildMsg (‘Received Child Message’);
}


########

public class ParentSWF extends Sprite
{
private var loader:Loader;

public function ParentSWF():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest('ChildSWF.swf'));

//~~~~~~~~~~~
tc = new TextField( );
tc.text = "No Message from the Child";
addChild( tc );

}
private function onLoadComplete(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;

addChild(e.target.content);

var swf:Object = loaderInfo.content;

swf.x = 75;
swf.y = 50;

swf.alert('Received Parent Message');
}

public function ReceivingChildMsg ( var childsMsg:String):void
{
tc.text = childsMsg;
}
}

How A SWF Child Can Control A Parents Function/variable ?
For instance in the below code a parent can control the SWF childs function alert ().

But how a SWF child can control parents function ReceivingChildMsg() ?

public class ChildSWF extends Sprite
{
private var t:TextField;

public function ChildSWF():void
{
t = new TextField( );
t.text = "No Message from the Parent";
addChild( t );
//~~~~~~~~~~
Button.addEventListener(MouseEvent.CLICK,clickHand ler,false,0,true);
}

public function alert(msg:String):void
{
t.text = msg;
}

protected function clickHandler(event:MouseEvent):void
{
ReceivingChildMsg (Received Child Message);
}


########

public class ParentSWF extends Sprite
{
private var loader:Loader;

public function ParentSWF():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, onLoadComplete);
loader.load(new URLRequest('ChildSWF.swf'));

//~~~~~~~~~~~
tc = new TextField( );
tc.text = "No Message from the Child";
addChild( tc );

}
private function onLoadComplete(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;

addChild(e.target.content);

var swf:Object = loaderInfo.content;

swf.x = 75;
swf.y = 50;

swf.alert('Received Parent Message');
}

public function ReceivingChildMsg ( var childsMsg:String):void
{
tc.text = childsMsg;
}
}

How A SWF Child Can Control A Parents Function / Variable ?
For instance, in the below code a parent can control the SWF childs function alert ().

But how a SWF child can control the parents function ReceivingChildMsg() ?

( Note: I am using Actionscript 3 )

public class ChildSWF extends Sprite
{
private var t:TextField;

public function ChildSWF():void
{
t = new TextField( );
t.text = "No Message from the Parent";
addChild( t );
//~~~~~~~~~~
Button.addEventListener(MouseEvent.CLICK,clickHandler,false,0,true);
}

public function alert(msg:String):void
{
t.text = msg;
}

protected function clickHandler(event:MouseEvent):void
{
ReceivingChildMsg (Received Child Message);
}

########

public class ParentSWF extends Sprite
{
private var loader:Loader;

public function ParentSWF():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest('ChildSWF.swf'));

//~~~~~~~~~~~
tc = new TextField( );
tc.text = "No Message from the Child";
addChild( tc );

}
private function onLoadComplete(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;

addChild(e.target.content);

var swf:Object = loaderInfo.content;

swf.x = 75;
swf.y = 50;

swf.alert('Received Parent Message');
}

public function ReceivingChildMsg ( var childsMsg:String):void
{
tc.text = childsMsg;
}
}

How A SWF Child Can Control A Parent’s Function / Variable ?
For instance, in the below code a parent can control the SWF child’s function “alert ()”.

But how a SWF child can control the parent’s function “ReceivingChildMsg()” ?

( Note: I am using Actionscript 3 )

public class ChildSWF extends Sprite
{
private var t:TextField;

public function ChildSWF():void
{
t = new TextField( );
t.text = "No Message from the Parent";
addChild( t );
//~~~~~~~~~~
Button.addEventListener(MouseEvent.CLICK,clickHandler,false,0,true);
}

public function alert(msg:String):void
{
t.text = msg;
}

protected function clickHandler(event:MouseEvent):void
{
ReceivingChildMsg (‘Received Child Message’);
}


########

public class ParentSWF extends Sprite
{
private var loader:Loader;

public function ParentSWF():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest('ChildSWF.swf'));

//~~~~~~~~~~~
tc = new TextField( );
tc.text = "No Message from the Child";
addChild( tc );

}
private function onLoadComplete(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;

addChild(e.target.content);

var swf:Object = loaderInfo.content;

swf.x = 75;
swf.y = 50;

swf.alert('Received Parent Message');
}

public function ReceivingChildMsg ( var childsMsg:String):void
{
tc.text = childsMsg;
}
}

Control Movieclip With Dynamic Text Variable
Hi,

I'm trying to integrate a nav section with a .swf. I want to be able to use normal html for the nav links, and to pass a variable to the swf using setVariable, and for that variable to trigger a movie clip to play.

So far, I'm able to get the variable in to the swf and for it to show on the page. However, it's not triggering the clip to play.

I've got this in html:


Code:


<SCRIPT LANGUAGE="JavaScript">
<!--
// set the variable in the SWF
function changetext(str){
if(window.Dog) window.document["Dog"].SetVariable("var_myText", str);
if(document.Dog) document.Dog.SetVariable("var_myText", str);
}
//-->
</SCRIPT>
</head>
<body bgcolor="#ffffff">

<object classid="yada" codebase="http://yada" width="75" height="150" id="Dog">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Dog.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />

<embed src="Dog.swf" quality="high" bgcolor="#ffffff" width="75" height="150" name="Dog" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

<form name="form1" method="post" action="">
<input type="button" name="One" value="hello" onClick="changetext('hello')">
</form>
</body>



and


Code:


stop(); //because i don't want it to play till the variable is passed in
if (var_myText == "hello") {
gotoAndPlay(2);
}



on the actions layer. The dynamic text field has a Var: var_myText set. When I try this in the browser, the field is correctly updated with "hello," but the if statement doesn't fire.

Thanks,
John

Creating Slideshow: How To Pass Variable From Level1 To Control Level0 Timeline?
Hi, newbie here...

Thank you in advance for anyone that can help with my question. I appreciate your time and will not be a pest in this forum...

I am a photographer in Toronto and have a website that I have created in Flash and is located at www.ssonne.ca

I am working on creating a slideshow of all the photos on the site.
The way it works now, each button on the main movie loads in a new movie into level one using loadMovieNum. Each movie is three frames, and shows a progress bar and then a photo.

What I would like is to pass a variable from frame three of the movie on level1 to the main movie on level0 so I can check that the photo is fully loaded and then continue on with the slideshow.

Seems simple enough, yet I spent hours reading through a lot of sites and couldn't get anything to work for me.

Any help is much appreciated, and I hope you enjoy the photos if you take a look at my site...

- Stephen

Transfer
I am working on re-designing my site. I am going to be adding games, and someone gave me the idea to make it like a tap dance game (if you haven't been to my site, I am a tap dancer).

I would like to transfer the tap sounds onto the computer.

Does anyone have any ideas on how to do this?

Thanks!

Michael

Transfer Value Into Php
using flash8 , i wanna transfer the value in flash into php , how can i do

Transfer For The Web
After you finish a project, what do you do to have it enable for the web?

Transfer Of Power
hi - i'm pretty new to flash and have been working through the tutorials in joshua davis' book 'flash to the core' recently. i have adapted chapter 21 "transfer of power" for a project of my own, which functions perfectly exported as flash 6 (im using flash mx), but have been totally unsuccessful getting it to work in flash 5. when exported it as a flash 5 movie, it looses all functionality.

i understand this is the same technique used in the motown.com site a couple years ago so im assuming there's gotta be a way to make it work with 5, im probably just missing something completely obvious. any help will be greatly appreciated.

thanks, emil

iv included the actionscript im working with below, which all lives in a keyframe on the main timeline:



------------

fscommand("fullscreen", "false");

fscommand("allowscale", "false");

stop();

// set up gutter info

gutterLeft = scrollbarGutter_mc._x+1;

gutterRight = scrollbarGutter_mc._x+(scrollbarGutter_mc._width-_root.scrollbar_mc._width)-1;

// create an array for attaching new sections on our timeline

section = new Array(10);

max = _root.section.length;

itemDepth = 1;

for (i=0; i<max; i++) {

// attach new item

_root.content_mc.attachMovie("section", "section_"+i, itemDepth);

curItem = content_mc["section_"+i];

// put the MC in an array

_root.section[i] = curItem;

if (i == 0) {

curItem._x = 0;

} else {

curItem._x = content_mc._width+1;

}

itemDepth++;

}

// set the info about the content

contentRight = content_mc._x;

contentLeft = 707-content_mc._width;

// calculate the current percentage of the scrollbar

function scrollBarFunc() {

var percent = (scrollbar_mc._x-gutterLeft)/(gutterRight-gutterLeft);

content_mc._x = percent*(contentLeft-contentRight)+contentRight;

updateAfterEvent();

}

// jump the scrollbar to an area on the gutter that equals the beginning of each section

function contentFunc() {

// is the difference between the goal and the position small?

if (Math.abs(scrollBarGoal-scrollbar_mc._x)<1 || !topNav) {

// if so, position everything where it needs to be and stop

scrollbar_mc._x = scrollBarGoal;

content_mc._x = contentGoal;

// transfer power by turning scrollbar actions off

onEnterFrame = null;

} else {

// otherwise move scrollbar and adjust content

scrollbar_mc._x += (scrollBarGoal-scrollbar_mc._x)/6;

scrollBarFunc();

}

}

function moveContent(s) {

// transfer power - turn topNav actions on

topNav = true;

// where should the content go

contentGoal = contentRight-section[s]._x;

// make sure its not off the screen!

if (contentGoal<contentLeft) {

contentGoal = contentLeft;

}

// what percent is that goal?

var percent = -(contentGoal-contentRight)/(contentRight-contentLeft);

// apply that percent to the gutter size to determine the scrollbars goal

scrollBarGoal = percent*(gutterRight-gutterLeft)+gutterLeft;

// set up a loop to move the content and scrollbar

onEnterFrame = contentFunc;

}

// don't use the hand icon

scrollbar_mc.useHandCursor = false;

// handle press event

scrollbar_mc.onPress = function() {

this.startDrag(false, _root.gutterLeft, this._y, _root.gutterRight, this._y);

// transfer power - turn topNav actions off

topNav = false;

dragging = true;

this.onMouseMove = function() {

_root.scrollBarFunc();

updateAfterEvent();

};

};

// handle release event

scrollbar_mc.onRelease = scrollbar_mc.onReleaseOutside=function () { this.onMouseMove = undefined;this.stopDrag();dragging = false;xSpeed = (newxpos-oldxpos)*RATIO;};

// set initial variables

FRICTION = .9;

RATIO = .5;

dragging = false;

// handle onEnterFrame event

scrollbar_mc.onEnterFrame = function() {

if (!dragging && !topNav) {

oldxpos = this._x;

newxpos = oldxpos+xSpeed;

xSpeed *= FRICTION;

if (newxpos>gutterRight || newxpos<gutterLeft) {

xSpeed *= -FRICTION;

newxpos = oldxpos;

}

this._x = newxpos;

_root.scrollBarFunc();

} else {

oldxpos = newxpos;

newxpos = this._x;

}

};

Text Transfer
I have two boxes one with 7 text options in and which is blank. When an option is clicked I would like the text chosen to appear in the blank window. If another text option is chosen that text will appear below.

Any one got any ideas how to do this??

Cheers

Jemes

Transfer Coordinates
Hi, I have been looking to dynamically draw a box around a shape that can be rotated.

This shape is inside another shape call MyStage.

I have tried using localToGlobal (not get bounds), and failing. I think I am failing because I am trying to do all of this with a function that lives on neither Clip.

At the moment I am putting the _x, _x+_width, _y, _y+_height to get the bounds and then convert those coordinates to the clip below.

I am not using getBounds because that results in a big box when its rotated.

I'm not having too much success...

Any suggestions?

M@)

Actionscript Transfer
is there a way to give an instance of an mc or button action scripting by being able to transfer a/s from an input field

Score Transfer
how would i keep whatever score they got on first round and add to second round and also allowing it to continue raising?

Transfer A Symbol
How to transfer a symbol from 1 flash file to other file?

Thanks

Copyright 2005-08 www.BigResource.com, All rights reserved