Actionscript 3.0 :: Passing Variables To A Button Event In An XML Loop?
Dec 11, 2009
I'm trying to figure out the run-time issue I currently have with passing an array[variable] to a button within an XML extraction loop.like...
on Complete {
try {
// parse XML attributes to AS variables
[code].....
View 2 Replies
Similar Posts:
Jan 21, 2009
I'm using a few for() loops to populate my game. Now, I have 2 versions of each function, one that executes when my variable "debug" exists, and the other that activates only if "debug" does not exist.Looks kinda like this:
ActionScript Code:
// first, if debug exists, the script will execute for the single instance of my movie clip "myBox_0".
if(debug){
// assign a value to the string "myTarget"
[code]....
Now, on the line I starred*, if I enter "images/0" instead of what you read there, then it works. But when I try to use the variable "i" then it gives me the error "Error opening URL 'images/undefined.png'" I ran a trace statement to track "i" through the code and it works up until I enter the tellTarget statement... how can I get my script to pass that variable through that statement?
View 2 Replies
May 8, 2009
Say I have an array with 4 string elements that are 4 different urls. On the stage I have 4 movieclips that I want to have listen for a CLICK event. When the user clicks a button, the navigate to one of the 4 urls.I can loop through the buttons and add and event listener to each:
Code:
private function applyPlankLinks():void {
for (var i:uint = 0; i<numberOfPlankBtns; i++) {
[code].....
View 2 Replies
Apr 30, 2009
trying to learn Custom Events so that I can pass a variable through to a function that's fired when a Fade Out has been completed.
i.e.
Code: Select allvar tm:TransitionManager = new TransitionManager(movieclipname_mc);
tm.addEventListener ( "allTransitionsOutDone", TriggerThis );
tm.startTransition({type:Fade, direction:Transition.OUT, duration:2, easing:Strong.easeOut});
When the Fade Out is completed, the TriggerThis function is fired...
Code: Select allfunction TriggerThis(e:Event):void {
trace('triggered');
}
I want to pass a variable to TriggerThis though and I know that I need to use a Custom Event to do this. I tried creating a .as file containing the following:
Code: Select allpackage
{
import flash.events.Event;
[code]....
But this results in errors. Can anyone shed any light on how to pass the variables after a Transition has completed?
View 2 Replies
Apr 30, 2009
I've spent most of this afternoon trying to learn Custom Events so that I can pass a variable through to a function that's fired when a Fade Out has been completed.
i.e.
[Code]....
So I'm not sure that I'm even close to getting this right.
how I can pass variables to a function called when a Transition has completed?
View 3 Replies
May 12, 2009
I'm using the following addlistener to listen for a custom event the event works if i put e.Event in the functions parameter but i don't get the passed variables however if i go into the .as folder where the dispatch originates and put EventType in the parmeters field of the function then i get all the variables.........but if i put EventType instead of e.Event in the first example then I get undefined for EventType.....how do give access to EventType?
[Code]...
View 7 Replies
Feb 14, 2011
I have 2 swfs, one image loader which I built a while ago and will eventually update to AS3 and a newer swf I built in AS3. I want to be able to 'pull' a variable from the AS2 swf when a button on the AS3 swf is pressed. How might i be able to do this. LocalConnection wont do it I dont think - i cant load the AS2 swf into the AS3 swf and obviously cant do the reverse though this would be the way to do it if it were possible. So when a button in the AS3 swf is pressed I want to call the AS2 swf and return a variable from the AS2 swf (the filename of the current image). Would both swfs sharing ExternalInterface work?
View 2 Replies
Dec 8, 2009
I followed the tutorial and have SWFAddress setup and it works fine in one way (the browser is showing the right thing) but since all buttons on my site use one and the same function (what happens depends on the button witch was clicked - using the e.target variable) I can't tell flash what has to happen when the browserbuttons are used. As in the tutorial I'm working with a switch statement where I call the MouseEvent function for every possible case, but I can't find out witch variable to pass inside that function.
url (it's a french site about birth, some pictures are kind of explicit) [URL]
View 4 Replies
Jul 22, 2009
I would like to pass Parameters to a functions from a button click. Currently I need to call a function that in turn passes the Parameters.
example
gardengate_btn.addEventListener(MouseEvent.CLICK, onClick_gardengate);
function onClick_gardengate(e:MouseEvent):void{
/*Sends the xml and the paintingCount_Numb to the parseXML function.
This will display the text and images for each painting
*/
ParseXML(xmlData,0);
}
I would think that i could just do this but it gives me an error. gardengate_btn.addEventListener(MouseEvent.CLICK, ParseXML(xmlData,0)); 1067: Implicit coercion of a value of type void to an unrelated type Function.
View 1 Replies
Jun 26, 2003
I would like to know if it is possible to pass a clip event on to both the function that has a listener, and to the button that is being pressed. I am finding the listener takes it and thus the button doesn't see it.I found a walk around, however, I'd like to know if it is possible say for one clip event to be seen by both objects?For example, with the mouse over a button the listener function detects the event and carries itself out, however, the button misses the event now.
View 2 Replies
May 10, 2010
I'm trying to reference a movieclip that's been passed through the class primary function (constructor/instance, tried both) but can't get a button event instance to recognize it. Since the button's based around an event, I'm not sure how to pass the reference. I stripped a lot of the code, but left the function sctructure as the button events are tied into a dynamic loop structure, a main reason why I can't move the buttons to a different class.
The example looks something like this:
package {
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.events.*;
[Code] .....
I'm trying to figure out how to get the site_mc reference to the button event so it can trigger other nested movieclips inside it (gallery_mc, etc). If this were AS2 it'd be a piece of cake but now I have all these invisible walls for variable passing.
View 11 Replies
Aug 13, 2010
Here is my full code
import fl.controls.*;
var test:MovieClip = new MovieClip();
var btn:Button;
[code]....
Result:
You clicked 8
You clicked 8
You clicked 8...
Is there anyway, such that, I can use for loop to create different name button, and add it to an event listener?
View 3 Replies
Dec 2, 2010
How to trigger a custom jQuery event from Flash, passing some data through event object?
View 2 Replies
Apr 20, 2010
[Code]...
I used to actuate the painter function by using a MouseEvent although I'm prefering to do it this way, but I'm having issues with an error "1120: Access of undefined property thisMouse." Error in Bold I've attempted to pass the Mouse Event to the painter function but had no luck. A simple solution (even potentially dangerous and WRONG) would be fine here, as this is part of University Coursework and I haven't been taught Classes etc. Its basically an introduction to scripting but im trying to do things slightly out of my depth
View 5 Replies
Feb 21, 2009
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
View 5 Replies
May 5, 2011
Say, I had a loop in a function...
[Code]....
How would I refer to a in another function
View 8 Replies
Feb 8, 2009
I have a swf with an input text box and a button. When the button is clicked, I need it to open another swf in a new window on a different domain and pass the variables to a dynamic text box in the new window. I looked at local connect but I wasn't sure it would work because the two windows wouldn't necessarily be loaded at the same time and they are on different domains.
View 4 Replies
Sep 9, 2009
I am loading images into a movie clip dynamically from an XML file. Based on what image the user clicks, I would like to be able to open a separate window, displaying a different image. Ideally, I'd pass the variable of which image was selected to the new open window.I've done some research online, and am thinking I'm making this harder than it needs to be.
Actionscript from main movie
Code:
chosenImage.onPress = function() {[code]......
I've also seen where I could possibly pass a variable through ASP.NET, but am experiencing the same errors when trying to pass the variable. I suppose I could embed the popup.swf file in a new .aspx page, that would probably be acceptable.
View 1 Replies
Jan 6, 2010
I'm using IE 8 and trying to open an HTML file. All files are either local or ran on a server. Problem is I use the URLVariables object, and they still won't get passed. for example:
Code:
var req:URLRequest = new URLRequest("Y:/htmlFile.html");
var urlVars:URLVariables = new URLVariables();
[code].....
View 14 Replies
Jul 21, 2010
I just want to show the contents of the input data in Movie Clip Movie Clip A into B which is still in one layer.
View 2 Replies
Sep 6, 2010
I'm trying to develop a site map, which draws a tick over the sections of my app that have been completed. I've figured out how to draw the tick and how to pass variables from root to the MovieClip that the function is in.
To make the tick appear only after an mc has been watched, I tried setting a variable equal to 1 ino the last frame of the MovieClip, and telling the function to run if that variable was 1.
I'm not getting compiler errors, but I'm also not getting the tick. And I'm definitely completing the Movie
Here's what I've got so far: In root
Code:
var xcoord = 125;
var ycoord = 300;
var WaterComplete = 0;
In WaterMovie
[Code].....
View 3 Replies
Nov 25, 2008
I am trying to pass value and string from AS3 main.swf to AS3 child.swf loaded in it. But, Nothing is working and i can't get the value from one to another. As Beginner in AS3, i was working for a long time and
still i face these problems and no output yet.
[Code]...
View 1 Replies
Nov 17, 2010
I am having some trouble in passing variables from AS3 to PHP. I am using flash and php both in the same file [try.php]. I've stuck with this for two days.. Here's what I have done. header.fla [Actionscript in the timeline]
[Code]...
View 5 Replies
Sep 4, 2010
Creating a flash project where users can visit the site, and turn off/on objects in a house (ie. lights, tv, computer, etc.) The next user who will visit the house in the website, will see what lights or house appliances were left on. Flash variables are passed to PHP, and those variables are saved in an XML file. (For testing to see what is being saved to the XML file, on each click --vars.xml opens.) In the vars.xml file, I see that the house objects that were last turned on--are saved in the XML file- But in the SWF file, only one of the objects that are listed in the XML are turned ON. Only the last object that was clicked on would show ON--not all the objects in the XML file.)
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.text.*;
import flash.net.*;
public class House extends MovieClip {
[Code] .....
View 1 Replies
Nov 19, 2010
I am having some trouble in passing variables from AS3 to PHP. I am using flash and php both in the same file [try.php].
I've stuck with this for four days.. Here's what I have done.
header.fla [Actionscript in the timeline]
Code:
stop();
import flash.events.Event;
import flash.display.Sprite;
[Code].....
View 5 Replies
Sep 4, 2005
I am using FLASHVARS to pass a variable (Status) from ASP to Flash.This piece of Flash (named Header), calls another SWF (named InOutPencil) using this command:[code]My problem occurs when I try to use the Variable 'Status' in the InOutPencil SWF (below).[code]I need a way of passing the value of the variable 'Status' from Header to InOutPencil.
View 3 Replies
Feb 24, 2006
I need to pass the following php information into flash...
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$link = "<img src ="$mosConfig_live_site/images/comprofiler/tn";
$link_gallery = "<img src ="$mosConfig_live_site/images/comprofiler/";
[Code]....
This php script displays the top 20 users from a database based on their hit count. The script passes their avatar (image), username and link, as well as total hits.
I wanted to create a flash file with one movieclip that would parse the php file and display the results in an i++ fashion, so that I could make changes to only one mc instead of 20, when needed.
I have tried making a dynamic text field an mc, and assigning the loadvars object to that mc... but can't get any information to display... and I know the php file works like a charm.
View 10 Replies
Nov 21, 2007
in my main movie, i have done a survey, see my previous thread which collects data from a series of radioButton groups. i can display this data using dynamic text boxes no problem, however i also wish to display this data in a separate swf which has been loaded into the main movie via a movieclip using
Code:
_root.cm_handler.loadMovie("movie2.swf");
View 1 Replies
Aug 31, 2008
i got this working in AS2 and PHP, but i can't use the VAR option on the dynamic text ... so how would i do this in AS3 ?
here's the simple code
using AS2 and PHP 5.2.6
ActionScript Code:
//
// create an object to store the variables
varReceiver = new LoadVars();
// load the variables from the text file
[code]....
and the PHP Code in info.php
PHP Code:
<?php$fName = "nuno";$lname = "mira";$age = 24;// echo or print the variablesecho ("&fName=$fName&lName=$lName&age=$age&");?>
View 6 Replies
May 11, 2002
I'm trying to get one movie to send a variable to another movie. how to check the string that's being sent, and have the movie do stuff based on what string is being sent (if (string=="bla"){gotoAndPlay("bla");}.
View 5 Replies