ActionScript 2.0 :: Make A Button Calling XML Nodes?
Jul 1, 2010
I want some help sorting out my buttons on a site i'm building.At the moment i can get the main page to load, but i can't work out how to make a button call a certain node of an xml file.This is what i have so far: This one is on the first frame of the site:
Code:
function loadXML(loaded) {
if (loaded) {
_root.hheaven = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;[code]............
View 1 Replies
Similar Posts:
Oct 15, 2003
I'm trying to retrieve information from an XML that is being sent to flash from an ASP.My problem is that I am not sure of how the XML hierarchy works in flash.
The XML sent to flash is something like this:
<Login><Message>Login Correct</Message><Handle>Myname</Handle></Login>
I have an XML object in flash that stores that XML being loaded (myXML) I need to know how to pull that Handle nodeValue (Myname).This variable stores the Message nodeValue (Login Correct):
var login = myXML.firstChild.firstChild.firstChild.nodeValue
so the variable login stores the info correctly. I just can't get another variable to store the other nodeValue:
myXML.firstChild.firstChild.firstChild.nextSibling .nodeValue?
View 4 Replies
Nov 12, 2010
I know this has been asked right before im doing it, but i have a slightly different problem. I have read all the tutorials and stuff out there, but i cant figure this out, call me stupid if you want i have an xml structure like this:
[Code]...
View 1 Replies
Dec 8, 2011
I develop a piece of code that brings me to an xml, all Nodes i use this code:
for(var i=0; i< menu_xml.childNodes.length; i++){
corrent_node = menu_xml.childNodes[i].length;corrent_item.action = corrent_node.attributes.action;corrent_item.variables = corrent_node.attributes.variables;corrent_item.name.text = corrent_node.attributes.name;
[code]....
What I need is for each of the nodes highlighted in green to return the child Nodes. Example: when I move the mouse over the menu Indoor lighting, the results should be: Indoorlighting | LED 10W> 3W LED> LED 6W
View 10 Replies
Jan 26, 2006
For those unfamiliar with tree structures, tree structures are usually dynamic lists where every node has a pointer to two other nodes. They are arranged so it makes for faster searching and stuff and are very useful in programming languages that offer direct access to heap memory. Although I don't know if there would be benefits of making tree structures in AS would be of any help but I decided to have a go at it anyway. Since there are no pointers in flash I tried to just replace pointers to nodes with nodes themselves. Such things usually work in java I think because the language just automatically makes pointers for variables.
[Code]...
View 3 Replies
Nov 5, 2009
I have a flash ecard that I am working on and had one of those "wouldn't it be cool if..." moments!
I would like find out if it is possible to:
1) load in an xml file that contains several names
2) Load each one of those names into a predefined movie clip which would display the name
3) randomize the placement of each name in a given shape area so that the Movie clips with names would randomly fill in to make a specific shape.
View 1 Replies
Oct 8, 2009
I am adding some XML nodes clip_mc to my box0 movieClip and I am not able to figure out how to give them button property.[code]
View 0 Replies
May 26, 2010
I'm running flash cs4. I have an xml file I've loaded in but cs4 actually takes out the root nodes. So now I've been trying to add them back in when a button is pressed but I can't do it. I looked at creatElement and appendChild functions they seem to be what i need but I can't get them to work.
View 1 Replies
Feb 9, 2011
I'm trying to use the delete keyword to remove nodes from an xml file and it just plain won't work.Here's a stripped down example of what I'm working with. Every node has a child named "deleteme". If its value is equal to 1 I want to remove it from the xml file. If its anything else I want to leave it be. The delete method is deffinately gettig call but it's having no effect.
<?xml version="1.0" encoding="utf-8"?>
<stuff>
<i>
[code]......
View 1 Replies
May 14, 2009
I've been reading over numerous tutorials and guides as well as the Language Reference for ActionScript 3.0 but cannot quite seem to find anything to learn what I need (which I guess is because everything I have read assumes you would already know how to do this sort of thing).On my stage I have one button (mybtn) and one MovieClip. Within the MovieClip I have numerous other MovieClips (the different parts of a character, leg, arm, head, etc).
One of those MovieClips, lets call it "upper_left_arm" (within the other MovieClip "character") is comprised of two Keyframes, frame 1 and frame 2. There is also a second layer with AS in it, which just has "stop()" in it so it doesn't endlessly play.When I click the button on my stage I want to change the playhead to frame 2 and then stop within the "upper_left_arm" MovieClip.I gather that I almost certainly need to use gotoAndStop.However, most information I have found concerning buttons, AS3 and the gotoAndStop command relate to "scenes" which as far as I can tell are nothing to do with what I want.
Code:
stop();mybtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
upper_left_arm.gotoAndStop(2);
}
The "(2)" is the part I think I have horribly wrong, I've tried various other things after "upper_left_arm.gotoAndStop" with no success. In fact, the MovieClip "upper_left_arm" now loops round merrily despite the "stop()" in the AS in that MovieClip itself .
View 2 Replies
Mar 24, 2010
I'm working on a website [URL]... I am basically attempting to call up Lightbox 2 from the 'VIEW GALLERY' button in the swf as you can't make the whole swf a hyperlink..
[Code]...
If there are an easier/other ways of doing this I am open to suggestion, I'm essentially trying to get a button within an SWF to call up Lightbox 2
View 1 Replies
May 17, 2009
I have 4 instances of the same button on a single layer in a timeline of the mc 'coverflow_mc' named 'ThatsMe_btn_a' to 'ThatsMe_btn_d' ie same button, same position.. it just changes instance name on 4 keyframes. Why does it call the function fine for button a but not for b,c, or d? There is a stop on each of these frames and I can see from the swf that it is stopping at the correct frames.
function thatsMe() {
right = new Sound();
right.attachSound("right");
[Code]....
View 3 Replies
May 27, 2009
i have created array of button and i want to call a frame according to the order or number of that button when it is clicked.
like
if i click 1st button it call a frame 1 of symbol named A
if i click 2nd button it call a frame 2 of symbol named A
if i click 3st button it call a frame 3 of symbol named A
[code]....
View 2 Replies
Apr 26, 2010
I have a function set up to stop a timer internal function pauseTiming():void { timer.stop(); } how would I call that function when a button is pressed, say with an instance name PauseTimer? I would also need to call the function startTiming when the button is pressed a second time. (or create two buttons, start and stop).
View 4 Replies
Jan 5, 2009
I am using prototype.js to make AJAX calls. I need to do this in a flash document to replace the contents of a <div> which contain a Flash movie, to be replaced by HTML.
Here's the code on the button:
Code:
on(Release){
[code]....
View 1 Replies
Oct 18, 2011
I'm having a problem where I have a button on the main timeline that when clicked needs to gotoAndStop first on frame 3, where there is a movieclip, that i want it to gotoAndStop on frame 30 (of that movieclip). Any ideas?
I can't have it just gotoAndStop on frame 3 and then have the code to gotoAndStop on frame 30 either because I need to be able to have the moviecliped called like this a number of different times.
View 2 Replies
Dec 4, 2009
My question has to do with tweened buttons that call an element onto the stage from right , on centre stage this called element stops centered. This is as far as I get...What I would like to happen is ,on the press of another tweened button the element from first tweened button vacates left and is replaced with called element from this button, and so on for 5 separate buttons, of course these can be pressed in any order..
View 5 Replies
Nov 11, 2011
I have these function which are called when the file is started. However how can I call it when I click a button:
function processXML(e:Event):void {
myXML = XML(e.target.data);
// after this executes you can call getXmlValues();
getXmlValues(nodeId,n,stopAtNumber);
} function getXmlValues(nodeId,n,stopAtNumber):void {
[Code] .....
View 10 Replies
Jul 20, 2009
The problem i am facing right now is a filename.php generates filename.xml.... and this filename.xml is called in my Flex Tree.Now everytime i update my DB, the values are not getting reflected into filename.xml unless i call the filename.phpNow how would i call filename.php from flex which will make the update of xml
View 1 Replies
Mar 14, 2011
Can anyone help me in this regard? I have Actinscript file in which I have defined a function like below:
actionScript.as (file name)
import mx.controls.Alert;
public function abc():void{
Alert.show("Inside abc(): My Button Clicked");
}
Now I have a button in mxml and I am calling the above function in my buttion "click" attribute like below.
Importing script in mxml:
[Code]...
View 1 Replies
Jan 22, 2009
I have created a flash movie with buttons. I intended for the user to press these button and open another flash movie or another html. I tried using URLRequest as such below but I got some errors when I run the flash and press the button:
function callSeries(evt:Event):void{
URLRequest("series.html");
}
Error:
TypeError: Error #1034: Type Coercion failed: cannot convert "series.html" to flash.net.URLRequest.
at mainmenu_fla::MainTimeline/callSeries()
Is this method wrong? How shall I call another html or refreshed a current flash movie embedded within a html with another new flash movie. Is this possible?
View 4 Replies
Jul 9, 2009
I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:
function vid1(event:MouseEvent): void{
pubPlayer.source = 'Steve480.flv';
}
In the child mc where the thumbnail buttons are, I want to call the parent function like this:
vid1_btn.addEventListener(MouseEvent.CLICK, vid1);
None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?
View 0 Replies
Nov 29, 2009
this is my first post on this forum so please take it easy on me as I am sure that this will be a simple answer for most of you out there. Here is what I am working with: I have dynamically added 4 buttons to the stage using XML data and a loop to place as many buttons as will allow per the data. Once the game begins, a MovieClip that I have also added to the stage will jump randomly from frames 1-16 and stop using a stage event listener. I need to have event-listeners on each of the buttons I have created using the XML data to check to see if the user has selected a correct answer. I had intended on using a function that would check to see which button was clicked and check to see what frame the movieClip was on when that button was clicked and judge right or wrong that way.
[Code]...
View 4 Replies
Feb 10, 2010
My problem is I don't know how to call buttons that are located inside the movieclip?
nav_btns is the movie clip on the main tiimeline, contact_btn is the button inside the mc
script example: nav_btns.contact_btn.addEventListener(MouseEvent.C LICK, btnClick);
everything is labeled correct and i still get a undefined error
but i figured it out "use the Target" in AS3
View 7 Replies
Jul 9, 2009
I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:
function vid1(event:MouseEvent): void{
pubPlayer.source = 'Steve480.flv';
}
In the child mc where the thumbnail buttons are, I want to call the parent function like this:
vid1_btn.addEventListener(MouseEvent.CLICK, vid1);
None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?
View 2 Replies
Sep 30, 2003
I can't get this to work. I need to call a Javascript function from a button in flash. The code is as follows:
on (release) {
getURL("javascript:nameOfMyFunction('whatever.html ')");
}
This is working, so I got the call right. But what I really want to do is have that url (html) to be a variable within flash.
on (release) {
Myurl="[URL]";
getURL("javascript:nameOfMyFunction('Myurl')");
}
This doesn't work. How do you use a flash variable as a javascript function parameter?
View 1 Replies
Jul 26, 2011
I have a situation where I'm calling a function with an event listener attached to a button, which in turn calls a function, which does a number things including calling a second function which resides in a child swf.
Just as an example:
Code:
myBtn.addEventListener(MouseEvent.CLICK, firstFunction);
function firstFunction(e:MouseEvent):void{
//I call another function in here (among other things)
externalSwf.stopTimer();
}
"StopTimer" resides in an external swf which for our purposes is called externalSwf and it resets a running timer.
Code:
function stopTimer():void{
myTimer.reset();
}
I'm getting argument mismatch errors, which often have to do with the Event Objects not matching. The event object for firstFunction is a mouse event triggered by a click so I put in e:MouseEvent...what I don't clearly understand is, what type of object event is dispatched when I call the function stopTimer from inside the function firstFunction?
View 6 Replies
May 13, 2004
on frame 1 : I define a function
exemple : function exemple(){
a=1;
}//end function
on frame 2 : line0 :exemple()
line1 : trace(a);
=> but there is no trace of a. the function has not been called but if I add a button with on release exemple(), the function exemple has been calledis this normal ? how can I call and execute a function without calling it trough a button.
View 2 Replies
May 13, 2004
on frame 1 : I define a function
[Code]...
but there is no trace of a. the function has not been called but if I add a button with on release exemple(), the function exemple has been called is this normal ? how can I call and execute a function without calling it trough a button.
View 2 Replies
Apr 1, 2011
I have a custom movie clip in the flvplayback skin and I am looking for a way to call an external js function.[code]Unfortunately, the External Function is not being called at all.
View 10 Replies