ActionScript 2.0 :: XML Loading Into Dynamic Buttons?
Sep 5, 2006
I am working on a dynamic menu for a client. This is my first time creating a menu loaded from an xml file. I have the basics down, but am hitting a brick wall. I will have six buttons that are attached at run time, and will be labeled according to the button names in the xml file. Eventually these buttons will be rotating in a circle, but I'm just testing the functionality at the moment. I tried searching through the forum, and didn't find anything that resembled what I am trying to do. To start off here is the xml file:
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<button buttonName="Home">
<content contentTitle="Home">[code].............
I have been able to trace the attribute names from the xml file, but textbox's from the dynamic buttons are not being labeled. They are coming up undefined.
P.S. This is the flow of how this project will take place: Load external xml file into Flash.Loop through elements to define the button label names.Create a loop to attach a movieClip at run time into a holder clip named "mcCircle".Label the dynamic text field in each new movieClip with the label names from the xml file.Arrange the movieClips on the stage in a circle movieClip.Rotate the circle movieClip clockwise using trig: sine and cosine. Set a speed and velocity variable to the circle movieClipWhen the mouse moves Over a button, have the circle movieClip slow down it's speed to a stop.When the mouse moves Out of a button, have the circle movieClip speed up to it's normal rotation speed.When the mouse clicks on a button, have the circle movieClip shrink down and move to the lower right corner of the stage.Tell Flash to load the content from the xml file (of the button label clicked) to a dynamic textfield on the stage. When the user is done reading the content they will click on a button to clear the text field, and bring the menu back to center, and original size.
View 4 Replies
Similar Posts:
Jun 7, 2006
I can't get the code to "know" which of the dynamic thumbnails has been clicked (by "know", I mean return an index value, say 0 through 7 if there are 8 projects, that I can use to access that particular project in the array of 8 projects in the rest of the code)... So if the third movieclip thumbnail were clicked, I'd like "2" to come up somehow... I've tried this code, which is kind of lame, I know, based off of the idea of each of the thumbnail movieclips' names ending in their index number:
Code:
//"this" is the button that was pressed; would return a string ending in
//thumberMC_<number of whichever movieclip thumb was clicked>
var: testString:String = this;
[code]....
Lastly, there's a dynamic textfield I'm trying to create that never shows up for some reason. Again, you could see in the FLA (in the "createDrawer" function around line 424).
View 9 Replies
Mar 21, 2009
I am using buttons with a dynamic textfield and a function to set the label for various different buttons:
public function setLabel(thisLabel:String) {
visibleLabel.text = thisLabel;
}
I set a label for each button:
btn_mc.button1.setLabel("2 | Al Sabkha Bus Station - Al Qusais Police Housing");
I have a dynamic textfield ... myText ... which I would like to use as a page title ... so once the button has been clicked, the dynamic textfield should update with the label of the button clicked.
View 1 Replies
Oct 14, 2011
All I want to do is add text from my string to dynamic text field when I click dynamic buttons. What should the as code be for this? Here is my code. Right now I just have the click returning another shape.
[Code]....
View 2 Replies
Oct 25, 2011
I am using Flash CS5 AS3. I have some code that makes a group of buttons from a css and xml file. I am trying to access individual buttons (for tweening/animating) but cant seem to find out which button is which and how to reference it. [code]...
View 9 Replies
Feb 17, 2009
i have some code in a movie clip where this.onPress is a function, and the action is:
Code:
_root.dyntxt.Text = "something";
but nothing happens..
View 3 Replies
Oct 28, 2008
I am pretty new to Flash and AS3. I built a Flash site that loads external XML data that auto loads with each page containing it.url...On the second page "Wines", as you can see, the white wine list auto loads just fine. But I cannot get my actionscript to load the XMLs from the buttons on the right (ie: whites, reds, dessert, champagne) [code] Also, as of right now, in the script I have the wines (fom said XML list) pop up in a new window (go click one to see). But it pops up in a new browser instead of a "popup". This is because I could not find a way to combine the java script with the XML in the actionscript to specify the new window(parent). I would rather it just load into the box (movieclip) dynamically, but I could not get that to work either.[code] Not even my intro Flash teacher can help me nor is there a tutor around either. Im kind of in a bad
position. Its just a matter of finding a person that knows Actionscript! No one knows it well enough in my class to help. If you know of a tutor who has an hour of time, I would be forever in debt. We can chat via AIM & send the raw files even.
View 1 Replies
Sep 6, 2009
I just spent 3 days making a drop-down-button-menu. It looks great.I added it to the HTML of my website, but everytime you load the page, you have to download the ActiveX control...How is it that people have drop-down-button-menus that are flash-based, yet they don't make you download the ActiveX control? Should I just scrap my buttons and try to use CSS, or HTML, or Javascript?
View 1 Replies
Oct 18, 2011
I was wondering if anyone could help me solve a problem im having with loading swf's into a swf with buttons. this is the code i have so far:
ActionScript Code:
import flash.ui.Mouse;
var _swfLoader:Loader;
var _swfRequest:URLRequest;
var _swfPathArr:Array = new Array("00.swf","01.swf","02.swf");
var _swfClipsArr:Array = new Array();
[Code]...
This code all works but when it loads the swf you can still press the other buttons which then load in the appropriate swf's. My problem is that i want the user to press the button, lets say "portfolio_btn" which loads in an swf called "01.swf" and for the user to not be able to press any of the other buttons until the "01.swf" has loaded and the same for all the other buttons loading in swf's.
View 7 Replies
May 24, 2009
On the stage I have buttons that should load different swf. Usually I should put all the code on a single "action" layer. But, it is not what I want to do I have a movie clip that I want to play before the loading ( button click - movie clip - loading the swf).
So I put this code at the en of the movieclip:
var mLoader:Loader = new Loader();
var swf;
var mRequest:URLRequest = new URLRequest(swf);
function startLoad() {
mLoader = new Loader();
[Code] .....
View 1 Replies
May 5, 2010
i would like to load external URL to my flash buttons from XML but no idea how to do it. There is 100 buttons. Buttons have unique names and i need to load url from xml to each button by the name of it and on click action go to this url. Any idea ?
button is s01, s02, p01, p02...... then i need address from xml with this name to load
<nodetop>
<address s01="some url here"></address>
<address s02="some url here"></address>
</nodetop>
my AS3 for now is this but dont know what to do next :
addEventListener(MouseEvent.MOUSE_OVER, loadname);
function loadname(evtObj:MouseEvent){
var btnname:String = evtObj.target.name;
[code]....
View 1 Replies
Oct 21, 2008
I am trying to dynamcally create several buttons using the Flash API. The following code hnts at the concept. But I can't sem to dynamically name and create the MovieClip since the attachMovieClip() method does not seem to exist in Actionscript 3.
View 4 Replies
Jul 10, 2007
I have been in the habit of making buttons with a dynamic text field. This way assigning a value to the var property of the text field would allow me to reuse the button symbol and assign different text to each. In AS3 it looks like the text field Var property does not exist any longer. Does anyone have a suggestion for a work around? I would like to avoid having to make a new symbol for each button.
View 9 Replies
Aug 8, 2009
I am currently working on a publications page, where i get the buttons dynamically from a xml-file. Everything is working so far, but the buttons are not showing up. I traced around a little bit and I found out, that the button is created and all that, but the text field is simply not showing. I used a predefined button mc, but creating "on the fly" would be more handy for me. Why the buttons are not showing up???
This is ActionScript Code:
function createButton(bLabel:String, yPos:int, xPos:int, id:int):void {
var button:MovieClip = new MovieClip();
var buttonL:TextField = new TextField();
//var button:pubButton = new pubButton();
button.name = "button"+String(id);
[Code] .....
View 4 Replies
Dec 21, 2009
I'm trying read xml from flash within a class. The only thing that's missing is creating as many buttons as the length of xml. The xml length works well in the function that loads the xml. When I put the xml length in the function on the buttons, it is equal to 0. How can I make all function read the value of xml length?
View 1 Replies
May 26, 2010
I'm having some problems on how to reference dynamically placed buttons. I am building a shopping cart and for every item in the cart a movieclip is duplicated and next to this movieclip I duplicate a few buttons (to delete and add an item)This is the code:
Code:
var id=0; //this value normally comes from the database
var amount = 10;//this value normally comes from the database
[code].....
View 9 Replies
Jul 16, 2010
So far when you hover over a piano key, its note name is displayed in an LCD screen with a dynamic text field. I know theres got to be a way to write a function that applies to all notes but so far I've written a function for every key! eg.
keyboard_mc.A0_btn.addEventListener(MouseEvent.MOU SE_OVER, noteOn);
function noteOn(event:MouseEvent):void
{
[code]......
View 2 Replies
Jul 16, 2010
I am trying to get a dynamic text box embedded in a button to populate on (XML) load but am having trouble with the path. The text boxes which are not embedded populate just fine. My fla and xml files are attached.
View 0 Replies
Feb 23, 2009
I have a site that has multiple pages of similarly sized buttons. These are magazine covers. I'd like for the mag covers and links they point to (loaded swfs) to be dynamically loaded via a text file, if possible. The client always has new magazines she's been in and to manually load the newest buttons first is a pain and time consuming.
View 3 Replies
Mar 26, 2004
I've a button with the instancename "steunen_btn". In this button there's a dynamic textfield called "weergave". Now when people select another language I want the buttons to change. So I thought I make a button with the following AS in it:
[Code]....
View 13 Replies
Aug 24, 2007
im trying to dynamically create buttons...here's an example scenario -> off stage is a movie clip called "originalButton_mc"I want to use a loop to duplicate this movie clip 25 times, and each one should be able to perform a unique onRelease function ex.
Code:
for (i = 0; i<25; i++) {
var newButton_mc = originalButton_mc.duplicateMovieClip("button"+i, i+1);
newButton_mc._y = i*22;
newButton_mc._x = 10;
[code]....
the problem with the above code is that when I click my new buttons it always traces 25...because, clearly - my code is wrong, and the onRelease is getting rewritten for each button - hence its left with the last i ... 25.
View 6 Replies
Dec 24, 2008
I have some buttons on my timeline and I want something to be done when I mouse over (for example) my button. The buttons have instance names of b1, b2, b3 and so on. Actionscript I`m using (for the first button) is:
b1.onRollOver = function() {
//blah
}
Same code goes for other buttons, I only change instance name. It is easy to do as I have a few buttons but what if I want 100 or more? It should be an easier way instead of using copy/paste.. Tried to solve this problem using loop:
howmuchbuttons = 3;
for(i = 1; i != howmuchbuttons + 1; i++) {
_root["b"+i].onRollOver = function() {
//blah
}
}
but it didn`t work as I expected.
View 2 Replies
May 1, 2009
I have a solution for this already, but it involves a million if/else statements so I was wondering if there's a way around this. Here we go.I'm making an RSS reader that displays posts in Craigslist. All the info I need is loaded into flash and immediately tossed into arrays. Well take the links[] array for our example.
I count the amount of links
for(i=0;i<links.length;i++){
and I make my boxes to hold the info
[code]......
View 2 Replies
Aug 6, 2009
joining this forum may be an awesome resource for future continued use. So, I have an as2 language selection front door in development utilizing xml influenced dynamic buttons being retrofitted for a global front door language toggle.
In production, it looks somewhat like this:
I have two main buttons that the 'for-loops' add. mainTabs and subTabs. On release on the subTabs, the are supposed to getURL defined by the link attribute in the xml file. However, I cant seem to have the getURL command target the proper address.
[Code]...
View 2 Replies
Nov 19, 2009
I have a directory of PDF's that I am loading the names of dynamically using PHP: My PHP file looks like this:
[Code]...
Now the code works perfect and it displays the name of all the pdf's but I want to somehow make a button on top of each displayed pdf that makes it clickable. The code is already storing the name of the PDF's so it should be pretty easy to do a getURL("pdfname","blank") or whatever I just don't know where to start. Here is the SWF output: [URL]
View 1 Replies
Dec 21, 2009
I'm trying read xml from flash within a class. The only thing that's missing is creating as many buttons as the length of xml. The xml length works well in the function that loads the xml. When I put the xml length in the function on the buttons, it is equal to 0. How can I make all function read the value of xml length?
View 1 Replies
May 10, 2011
i am creating an application in flash as3 that-load an xml file- parse the xml file-create the UI base on the xml filehere is the XML file
<data>
<button id="1" label="apple" content="This is an apple"/>
<button id="2" label="banana" content="This is a banana"/>
[code].....
View 1 Replies
Mar 26, 2004
I've a button with the instancename "steunen_btn". In this button there's a dynamic textfield called "weergave".
Now when people select another language I want the buttons to change. So I thought I make a button with the following AS in it:
Code:
on (press) {
_root.steunen_btn.weergave.text = "SOSTENGA";
}
This should change the text in the button to SOSTENGA right?
View 13 Replies
Dec 27, 2004
I've a digram with lots of button from top to bottom. At present all the buttons are manually placed on the stage and add corresponding links to each button. I've managed to add dynamic links on the fly but any other option to place buttons dynamically on the stage from library without overlapping one with another.
View 2 Replies
Sep 18, 2009
I wanted to make each button load an swf.How do I connect a button to loading a swf?
contentButton1.addEventListener(MouseEvent.CLICK, N);
function N(e:MouseEvent){
var request:URLRequest = new URLRequest("N-Infant.swf");var loader:Loader = new Loader()loader.load(request);addChild(loader);
View 2 Replies