Actionscript 3.0 :: Give Names/attributes To Buttons?

Aug 8, 2009

I have an XML-file.I want to base an menu on my website om this information.Let us say that I have info in the XML-file with the names "About Me", "Articles" and "Video".Then I want three buttons with the text above on them. This is successfully done.The problem is, that I don't know what button I am pressing. To go to the nest page I need to know what button I am pressing.

I've tryed the following:

Code: Select allprivate function buildMenu():void
{
for (var i:int = 0; i < menuArray.length; i++)
{

[code]....

The result is that all the buttons get the name of the last entry in the XML-file. In the case above all the buttons would get the name "Video".

View 4 Replies


Similar Posts:


Flex :: Get All Attributes Names Of An Object

Jan 17, 2012

Let's say I have a class which looks like this :

public class MyClass
{
public var attribute1;
public var attribute2;
}

and I'd like to get attribute1 and attribute2 as strings. I tried this :

var test:MyClass = new MyClass();
for (var key:String in test)
{
trace(test[key]);
}

but it does not work, it never goes in the loop. How can I do what I want to do ?

View 2 Replies

Xml :: Ignoring Case On E4X Node Names And Attributes?

Jan 26, 2010

Does anyone know of a trick to ignore upper/lower/camelcase on XML node names and attributes?A quick example: I give an XML file to my client which contains an XML attribute named fooID but the client could change the XML, and - not being aware of upper/lowercaseness change or add an attribute under 'fooid'. Naturally my parser (in AS3) would ignore the all lowercase attribute. Note that the value contained in fooID isn't the problem here but the attribute name itself.

View 2 Replies

CS3 Give Instance Names Quickly?

Jun 3, 2010

I have 100+ of the same movieclips on the stage at the same time, all positioned differently.i'm getting really tired of clicking on one of them, then clicking in the instance name box then typing "i65", then clicking on one of them, then clicking in the instance name box then typing "i66"...

is there anyway flash can fill this information in for you? or a plugin anyone's heard of? this isn't really an actionscript question, I'm not so fussed about selecting the different movieclips based on getChildAt or any of that stuff, I'd just really like a faster way of assigning instance names.

View 1 Replies

ActionScript 3.0 :: Can't Alter Or Give MCs New Instance Names

Aug 18, 2010

I've run into an interesting problem while working on a file. Everything was going really well until I got into work this morning, and suddenly I couldn't change any instance names on any existing movie clips. The movie still compiles fine, and everything that already had an instance name still has an instance name. However, I cannot change any instance names, nor can I give any new movie clips instance names. The instance name text box is grayed out and I can't select it. Everything else works fine, and I can give instance names to text fields that I create. I have no problems saving files, exporting SWfs, drawing, or animating.
 
After doing some research, it appears that this issue is limited only to my computer - everyone else can give instance names to movie clips, using the same files. Also, this problem appears to be affecting every file I open on this computer.

View 1 Replies

Actionscript 3 :: Detecting The NAMES (not Values!) Of The Attributes Of A XML Node In Flex

Jan 5, 2010

var node:XML;

In flex/actionscript 3, I can call node.attribute("somename") and get the value of the "somename" atribute of the node. I can also call node.attributes() and get the VALUES of ALL the attributes. But how the heck do I know what attributes to look for?! The application I am creating does not know the format of the XML file in advance. I need a way to know the NAMES of the attributes of the nodes, before I can access them by name!

View 1 Replies

ActionScript 3.0 :: Give different Instance Names To The Cells Of Grid?

Sep 10, 2011

I have a grid with 16 cells, and I want to give  each cell a different instance name; like for example, boxy1, boxy2, ....boxy16; how do I achieve that ?  Here is the code:
 
var rows:int = 4;var cols:int = 4;for (var py:int = 0; py <rows; py++){ for (var px:int = 0; px <cols; px++) {  var box:Box = new Box();  box.x = 30 + box.width * px;  box.y = 30 + box.height * py;  addChild(box); }}

View 6 Replies

ActionScript 3.0 :: Give Unique Instance Names To Multiple Children?

Jun 18, 2009

give unique instance names to multiple children of the same object?

I have a sprite that I would like to use action script to create 3 instances of on stage and then control each separately.

View 6 Replies

ActionScript 3.0 :: Give Buttons A Magnetic Effect?

Jul 16, 2009

I want to give my buttons a magnetic effect. Can someone please show me a tutorial on how to do this in AS3?

View 8 Replies

Flex :: Give Setfocus To The Alert Buttons?

Aug 19, 2009

I am using Flex3.0. in this i am craeting a custom component for an Alert.and for that alert i am applying styles. but when i opening the alert through the application i want to set focus on Alert button.means when i press enter button there are two buttons in alert YES and NO.i need to focus on YES button.

View 2 Replies

ActionScript 2.0 :: Want To Give Buttons A Bit More Life (wobble)?

Feb 3, 2004

I would like a bit of script that I could attach to some buttons so it looks like they are wobbling slighty on roll over.The atached jpeg shows the basic design of them - opaque with shadows.I would like the movement to be random, i can programme it already to move up and down or whatever, but not so its a differnt movement every time.

View 13 Replies

ActionScript 2.0 :: Give Buttons A Bit More Life Wobble?

Feb 3, 2004

I would like a bit of script that I could attach to some buttons so it looks like they are wobbling slighty on roll over.

The atached jpeg shows the basic design of them - opaque with shadows.

I would like the movement to be random, i can programme it already to move up and down or whatever, but not so its a differnt movement every time.

View 13 Replies

ActionScript 2.0 :: Way To Create Buttons To Give Content A Scrolling Function?

Feb 9, 2009

What is the best way to create buttons to give content a scrolling function.The functionality is provided by ScrollPane, where content, images etc. can be used and scrolled but aesthetically buttons are preferred.There is actionscript for creating scrollable text fields with buttons, but it requires constant clicking and only applies to text. Just mentioning this if there is something similar to attain the functionality of ScrollPane for content.

View 1 Replies

ActionScript 2.0 :: Create Buttons In One Swf That Load Another Swf And Also Give Instructions To Begin Playing From A Certain Frame In That Swf

Apr 21, 2004

What I'm trying to do is create buttons in one swf that load another swf and also give instructions to begin playing from a certain frame in that swf. The target swf has a preloader on frame 1 and then a movie clip that contains a video in frame 2. Depending on which button the user presses the video will be cued up ready to play at different frames. I think it may need an if statement ie if x=34 then goto frame 34, but I can't seem to pass the variables to the loaded swf. In the zip file is an example of what I'm trying to do.

View 11 Replies

Can't Set Different Names For Buttons

Nov 20, 2011

When I add two or more the same buttons and changing the name of one, the name of the others also changes. How to set different names to each button? I tried creating buttons by copying, duplicating and nothing...

View 6 Replies

ActionScript 3.0 :: Object Attributes From XML / Sub-attributes

Jun 29, 2009

I am dynamically creating a number of objects (movieclips) which all have a number of attributes.[code]and so on. i.e sub attributes. I don't think this is possible? Only sprite and movieclips can have dynamic attributes so unless atrbY is a movieclip (which it isn't, it's a string) it isn't allowed?Each object can have suboptions with further attributes associated with the chosen suboption.Later in the program I will manipulate, read and interact with the objects and they have text display behaviours dependent on the suboption chosen. That part (should) be straightforward! heh. One the object has the attributes attached in a usable format, accessing them should be simple.This will be for a store. i.e t-shirt1 has size small, price 10, size medium, price 12, size large, price 14. t-shirt2 has size medium, price 35, size large, price 40 and so on.[code]

This format of the XML can be adjusted if it would make the parsing easier.I am currently reading the XML in, stepping through, grabbing the individual parameter such as category and then adding it as an attribute of the object and it works fine. i.e. I end up with obj.category = 'catname'. However, on suboptions I am having a problem.Should I put all the suboptions in a multidimensional array and use nested loops to apply them to the object?I would still have the problem of objX.suboptionarray[Y].suboptionprice which isn't allowed? In the above XML case Y would be 0,1 and 2 giving 3 suboptions to objX and each suboptions would hold attributes such as pvid associated with that suboption.I could go down the horrible route, obj1.suboption1subptionprice ; obj1.suboption1suboptionpname; obj1.suboption1suboptionvalue; obj1.suboption2suboptionprice; obj1.suboption2suboptionpname and so on and so on for each suboption which could be five options (small,medium,large,x-large, xx-large) and which would "work" but would be bad programming and involve splicing names to get say, the "third" suboptions' price and pvid e.t.c

Going down the route of mutidimensional arrays sounds good except that on say 50 objects I would have stacks of arrays which I'm guessing isn't great in terms of resources?.Just to add, the number of suboptions varies between object, every object has a minimum of one suboption (default option) but can have as many as needed (unlikely to be more than 5 but should be scalable). i.e some t-shirts only come in medium whereas some have many sizes.I have a fair amount of leeway on the format of the XML which I generate from the database so the formatting of that could change to make the parsing easier.

View 0 Replies

Change The Names And The Hyperlinks Of The Buttons?

Nov 12, 2009

[URL]

how to change the names and the hyperlinks of the buttons given in this file...

View 1 Replies

Flex :: How To Assign Auto Incremented ID Names To Buttons

Mar 25, 2011

I am amateur in flex, and started my final year project in flex to learn it, I am stuck in place where I have to create rows of drop down lists when the user pressed add more, E.g.: like the ones in mail attachments. I think I have found a way to generate rows, I am not even sure whether it is a correct way, how I generate the rows:

<mx:states>
<mx:State name="newRow">
<mx:AddChild relativeTo="{cityDropdown}">
<s:DropDownList id="newbutton" creationComplete="hotelDropdown_creationCompleteHandler(event)" labelField="Name">
<s:AsyncListView list="{getAllHotelResult.lastResult}"/>
</s:DropDownList>
</mx:AddChild>
</mx:State>
</mx:states>

Now when I generate more rows the dropdownlist ids will conflict, so I want to know a way to generate ids, I think I cant even call a function in there.

View 2 Replies

ActionScript 3.0 :: Dynamically Create Buttons And Assign Them Names To Use Later

May 11, 2010

How to dynamically create buttons and assign them names to use later on in the code.? For example:

ActionScript Code:
If(a==3) {
create three buttons:

[Code]...

And then assign some functions for these buttons - like:

ActionScript Code:
but1.addEventListener.....

View 9 Replies

ActionScript 3.0 :: Passing Buttons Names To External .as File?

Jun 5, 2011

I am working on a project where I have on the stage 8 movie clips, and when hovered, they are to shake. I have made this into a class, and placed the code as an external .as file.

Each movie clip is named shaker_mc - shaker_mc7

I have also gone in and changed all of the button movie clips base classes to ShakeButton.

Right now I am getting a couple of errors, and I believe all i need to do is pass the buttons names to the class in the external .as file, but I am not sure how to do that? I had everything working without the external script, but I did not want to have to create the effect for each button.

The erros are:

1120: Access of undefined property shaker_mc.

Here is my code for the ShakeButton.as file

ActionScript Code:
package{ 
import flash.display.Sprite; 
import flash.events.MouseEvent; 

[Code]......

View 3 Replies

ActionScript 2.0 :: Adding Pause - Add A 7 Second Pause Between Each Phrase To Give People Time To Read Them (no Buttons)

Nov 25, 2006

I am using Macromedia Flash Pro 8. I have a flash intro that has words (phrases) which slide in. I would like to add a 7 second pause between each phrase to give people time to read them (no buttons). Could someone tell me the script(s) to use with all functions, etc. included - as I am so new to all this. I have been looking for weeks & tried many codes but none seem to work - or I don't know exactly where to place them - or both

View 3 Replies

ActionScript 3.0 :: Add Instance Names Of Buttons To Array / Add To Event Listener?

Jul 12, 2011

I was wondering if I had say 10 buttons and I wanted to add them to one event listener, is there a way to set up an array and attach them all to one event listener to cut down on code?

View 1 Replies

ActionScript 3.0 :: Losing Scope - Changing Both The Buttons And Mc Instance Names To No Avail?

Oct 23, 2008

I have a mc with simple btns inside. the mc is on every frame except one,in which I swapped a similar mc (different colors).I have tried leaving the instance name for the mc the same and also changing the instance name to something else but anytime I navigate to that frame, the buttons quit working.I have tried changing both the buttons and mc instance names to no avail.This is on my main timeline:

CrclMnTp_mc.CAbout_btn.addEventListener(MouseEvent.CLICK,
AboutNav, false,0,true);
CrclMnTp_mc.CSamples_btn.addEventListener(MouseEvent.CLICK,[code].....

View 3 Replies

Professional :: Importing AI Layer Names As Movie Clip Names?

Aug 26, 2010

We've got an Illustrator file with something over 1,000 layers. We're trying to import this into Flash and keep the layer names intact, such that they become the names of the movie clips that are imported for each layer and can be used programmatically. (It is a diagram and arrows, boxes, etc all have callout names that will eventually allow them to link to a database.)As near as I can tell, the Import dialog will NOT pass this info across between the two parts of the dialog.

View 1 Replies

ActionScript 3.0 :: Instance Names And Variable Names: It Goes Deeper

Mar 20, 2011

I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.

Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by

trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);

the output window gives me

drawer
instance2

Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:

drawer.x can be set;
instance2.x can (as we know) not be set.

But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?

I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?

View 8 Replies

ActionScript 2.0 :: Return A.attributes.first > B.attributes.first Will Return What Value?

Jun 8, 2006

i was mugging on this tutorial :

[Code]...

The return a.attributes.first > b.attributes.first will return what value?

View 1 Replies

AS3 :: CS3 : Count XML Attributes At Runtime?

May 27, 2009

After loading the following XML file, is there a way to count the number of attributes of the "question" node, and if possible, the number of items having the word "answer" in them? (in this case 4 should be returned, ie. answer1, answer2, answer3, answer4)

Code:

<?xml version="1.0" encoding="utf-8" ?>
<quiz>
<question text="The man went ___ the morning." answer1="at" answer2="on" answer3="in" answer4="out" correct="in" />
</quiz>

View 1 Replies

ActionScript 3.0 :: Search Attributes In Xml?

Dec 21, 2011

<leval0 layput="Menu">
<level label="s" type="level" levelid="1"/>
<level label="a" type="level" levelid="2"/>

[code].....

View 6 Replies

Actionscript 3 :: How To Filter XML Attributes

Jan 28, 2010

here's a painfully easy one I bet -- I'm aware of how to use EX4 to filter most pieces of the xml I need however how can I filter an XML list such as the one below to check say --- if a dog is a beagle? preferably as a Boolean.

[Code]...

View 2 Replies

XML :: Flex - How To Get Nodes By Attributes

Oct 22, 2010

I have XML below
<node id="id1"/><node id="id2"/>...
<edge id="eid1" fromId="id1" toId="id2"/>
<edge id="eid2" fromId="id3" toId="id1"/>
<edge id="eid3" fromId="id2" toId="id4"/>

Now I need get all edge base on nodeId,
nodeId = id1 -> eid1, eid2
nodeId = id2 -> eid1, eid3
nodeId = id3 -> eid2
nodeId = id5 -> Null

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved