ActionScript 3.0 :: Selecting Right Data From XML
Sep 13, 2010
I'm trying to create an gallery application that reads the pics from the server per category (= directory). I do this using a PHP that creates the XML file:
HTML-code:
<?xml version="1.0" encoding="utf-8" ?> - <categories> - <category name="Categorie1">
<image name="cat1Pic1.jpg" /> <image name="cat1Pic2.jpg" /> </category> - <category name="Categorie2">
<image name="cat2Pic1.jpg" /> <image name="cat2Pic2.jpg" /> <image name="cat2Pic3.jpg" /> <image name="cat2Pic4.jpg" /> </category></categories>
Now I can get to the categories(= directories) using this code:
ActionScript 3 Code:
var categoryAttributes:XMLList = galleryInput.category.attributes();
for each (var categoryNAME:XML in categoryAttributes){
trace("categoryNAME:" + categoryNAME);
}
This works, I get the directory names and create labels on stage and hang eventlisteners on them to handle user input. The next step is to select the corresponding pictures (that are in the "current" directory) and I just can't get it to work. My best effort so far is the following, but this code gives me ALL pictures, not a selection....
ActionScript 3 Code:
var categoryAttributes:XMLList = galleryInput.category.attributes();
for each (var categoryNAME:XML in categoryAttributes) {
trace("Hier komt de categoryNAME:" + categoryNAME);
// Get the right pictures
[Code] .....
And if I use galleryInput.category.image.name AS3 states that there are more than one value (of course). Now I have 2 questions: How do I limit the selection to just the images belonging to the "current" category? Is this the right approach? Or should I design it all different?
View 1 Replies
Similar Posts:
Jul 9, 2010
I've created an Flex app. It currently has an drop down menu. With the option to select a Channel. Once the channel is selected the data pulls through. But, what I want to do is just pull through one channel of data as opposed to multiple items of data. How can I achieve this?
My code is quite simple at the moment and looks like this :
<mx:FormItem label="Select your Channel : " x="296" y="0">
<s:DropDownList id="channelSelection"
dataProvider="{channelList.lastResult.channels.channel}"
[Code].....
View 1 Replies
Jul 12, 2010
I've followed the Flex in a week example, with the drop down menu that pairs the XML data to the XML node set.For the project I am creating, I am just pulling through ONE XML file containing just one node into my application.I am using HTTPService and pulling the data through, but at present the only way for this to work is by using the <s:DropDownList>[code]
View 1 Replies
Jul 3, 2009
I am trying to implement the following :
1> First column of datagrid has a checkbox.
2> Select checkboxes, and then delete the datagrid column.
3> Dynamically, add checkbox when row is added dynamically.
4> Do not show check box if now data in row.
View 4 Replies
Feb 22, 2011
The Following code seems to only be working when i have editable="true" on the Advanced Data Grid. But I don't want it it be editable.
The docs don't say anything about it needing to be editable, and i dont see why it should need to be.
[URL]
a_data_list.addEventListener(AdvancedDataGridEvent.ITEM_FOCUS_IN, clickedRow);
public function clickedRow(event:AdvancedDataGridEvent):void
{
trace("datagrid line was clicked");
}
View 2 Replies
Feb 11, 2009
I've been putting data into an array via XML, and then selecting at random an image string to load in a pic at random. But whilst doing this, I wanted to remove the String from the Array that I have just used, so I don't get repetition of the same image in the output. I initially thought that pop would remove the string I had just used - But of course it Removes the last value in the Array instead, which doesn't really help.
Ok - so how about randomizing the data once inside the Array, after it has been pulled in from XML!? That way I can load in the 'last' image, and then pop it out! Keeping a randomized selection of images each time 'it' is loaded
View 2 Replies
Apr 29, 2009
am creating a little game... It is about selecting some items...If 2 right items are selected on frame 1, the "next" button will appear for the user to click on it to go to frame 2.
View 1 Replies
Jul 4, 2010
When you add a new layer to flash it shows you that little black ball on the first frame.now when I add a new layer into flash it only shows an empty ball in the first frame, it's not filled with black. how do i fix this?
View 2 Replies
May 21, 2011
I want to develop an app, which will have a GUI, and will do real time processing of user input. App should work in most common web browsers, and processing will be client side. Also, the app must only work if user is online and logged in to my website. Something like a "license". People should not be able to hack/reverse engineer the code etc. Is it possible to do what I want using Java Applet or a Flash application? Any other technology?
View 1 Replies
Nov 8, 2009
I have a tower defence that i am making, and what i am trying to accomplish is to upgrade the tower selected, but it is only upgrading the last tower built. Here is my upgrading code:
ActionScript Code:
function everything() {
for (l=0; l<dtn; l++) {
dartSelected = dartTowerForReal[l];
[Code].....
View 0 Replies
Jul 21, 2009
I have this file [URL] with this code
Code:
import gs.TweenLite;
import gs.easing.*;
//Roll over and out button actions
var buttonArray:Array =
[code]....
1. Rather than using removeChildAt(5) how can I change this so I don't have to hard code in a number? As when I use this in my main project I get an out of bounds error.
2. How do I get my store text to match the pin that has been rolled over, so if pin 1 has been rolled over I get store one etc. At the moment I only know how to say storesArray[0]; which obviously isn't working for me.
View 2 Replies
Oct 26, 2009
I'm using a combobox component that I'm populating with a five-element array, as follows:
0 All
1 Bakery
2 Diary
3 Deli
4 Drink
And because I don't want "All" displaying in the text box, I've added the line
dropDown.text = "Select here..."
once the combobox is populated. Unfortunately, when I test the combobox and open the list, "All" is at the top of the list but already selected, so that when I click it, nothing happens. The rest of the items work fine.
Could someone tell me how to disable the first item, so that it's not automatically selected when the list opens and therefore can be clicked?
View 1 Replies
Nov 6, 2009
I've stupidly made a flash document with the default 550x400 pixels and I now need to scale all the content (buttons, MC, dynamically loaded images)
Is there an easy way to do this without selecting everything (problematic by the way) and using the transform tool?
View 2 Replies
Dec 28, 2010
I have around 40 mcs I want to use as buttons, how can I do something like this:
var mc:MovieClip;
for (var i:Number=1; i<=40 ; i++){
mc = MovieClip(MovieClip(root).getChildByName("m"+i));
[Code]....
Right now, when I roll over any of those mcs, always the last is working.
View 2 Replies
Jun 8, 2009
In coloring an object using the toolbar fill palette, I'd like to simply be able to double click on the color swatch in the toolbar, rather than click on the swatch and mouse down to the color and click again with the eyedropper. What's happening is that the color swatch in the toolbar contains a variety of colors around the one that it nominally represents. e.g. If the swatch is ff0000, double clicking on the swatch is likely to color the selected object anywhere from f30000 to fe0000 depending on precisely where in the swatch you double click.
View 1 Replies
Jan 28, 2010
somehow I switched the setting for selecting some frame in the timeline. I was used to click once and have one frame selected. Now it selects the whole time of a keyframe when I click on it not just the frame I clicked on.
how I can set it back how it was?
View 2 Replies
Jun 10, 2010
I am trying to write a flash app that will allow a user to select various regions of an image, similar to that of the selection tool in photoshop where a square region can be stretched and selected.
Would anyone have any ideas or tips for me that could get me going in the right direction? I have been researching for tools to help me write this but haven't been able to find anything useful..
View 5 Replies
Jun 17, 2010
I'm trying to select the id of a textArea when it's focused in
[Code]...
Problem is TextArea is made up of RichEditableText so target doesn't actually refer to TextArea. I've tried event.target.parent.id but still not getting there. Anyone knows how to get to the bottom of this?
View 2 Replies
Sep 22, 2010
My goal is to create a generic function that selects a value in a combobox according to a value. (My comoBox holds arrayCollection as dataProvider.) The difficulty is infact to get a propertyname in runtime mode.
public function selectComboByLabel(combo:ComboBox , propetryName:String, value:String):void {
var dp:ArrayCollection = combo.dataProvider as ArrayCollection;
for (var i:int=0;i<dp.length;i++) {
if (dp.getItemAt(i).propertyName==value) {
combo.selectedIndex = i;
return;
}}}
The line if (dp.getItemAt(i).propertyName==value) is of course incorrect.
It should be arther something like: dp.getItemAt(i).getPropertyByName(propertyName)
View 2 Replies
Feb 16, 2011
Is it possible to randomly select from variables in action script?I have tried using or -
question.text = question1 || question.text = question2;
View 2 Replies
Sep 29, 2009
I'm trying to build a portfolio gallery.I have it set up so that the user gets all my portfolio items to start with and then at the top right there is a comboBox that allows the user to select "programs", "code" and "clients" this changes the left vertical tileList to only show icons of the programs or of codes etc.I'm trying to get it so the user clicks on one of the program icons or whatnot and it then limits the thumbnails in the tileList on the bottom of my widget.The thumbnails come from a xml document that has the images and then <keywords>.Inside this node is a list of the programs and codes used.I tried using indexOf and then a if statement to check if indexOf was -1.But that didn't work.[code]
View 2 Replies
Dec 9, 2010
So you start off with all of the items in the inventory. You do not have to collect them.I have 8 MovieClips on the stage each with a different instance name. I made a class called Rebound and linked all the inventory MoivieClips to the Rebound class as the base class. they each have their own unique class.What I'm trying to do is select one of them. when you release the mouse off the movie clip (MOUSE_UP)it goes to frame 2 of its movieclip and making a variable I made up called isSelected = true.but when you click another item in the inventory I want it to deselect the item you clicked first so it goes back to frame 1 and isSelected = false. The problem I'm having is that it selects the first item when you click it. But when I click another the first stays on frame 1 and isSelected stays true. So if I click all 8 in a row they all become selected.[code]I thought this. called on every movieclip of the Rebound class?So instead of this. if there is something that can choose all of the movieclips that belong to the Rebound class I think I could use that instead. If there is such thing.
View 1 Replies
Jan 13, 2011
Im going to have multiple items in this game im making, and i want these items to be selectable. And i would have to be able to trace which was was currently selected.
View 1 Replies
Apr 20, 2011
I'm trying to dynamically move the desired MovieClip depending on how many times the right or left button is pressed.
I've written this:
nml:Number = numpos + 2;
nmr:Number = numpos - 2;
var nmlm:MovieClip = panels.panel(nml)
[Code]....
View 9 Replies
Nov 28, 2006
What is the actionscript for selecting a key on the keyboard such as 'down' arrow, and the movieclip moves to frame 60?
View 4 Replies
Dec 9, 2010
So you start off with all of the items in the inventory. You do not have to collect them.
I have 8 MovieClips on the stage each with a different instance name. I made a class called Rebound and linked all the inventory MoivieClips to the Rebound class as the base class. they each have their own unique class.
What I'm trying to do is select one of them. when you release the mouse off the movie clip (MOUSE_UP)
it goes to frame 2 of its movieclip and making a variable I made up called isSelected = true.
but when you click another item in the inventory I want it to deselect the item you clicked first so it goes back to frame 1 and isSelected = false. The problem I'm having is that it selects the first item when you click it. But when I click another the first stays on frame 1 and isSelected stays true. So if I click all 8 in a row they all become selected.
here's the class
Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
[Code]....
I thought this. called on every movieclip of the Rebound class?
So instead of this. if there is something that can choose all of the movieclips that belong to the Rebound class I think I could use that instead. If there is such thing.
View 1 Replies
Aug 18, 2009
I've written the following code to load images in a datagridcomponent by using a listcomponent. What code do i use to automatically select the first item.[code]
View 2 Replies
Sep 18, 2009
I've just got back to webbydesign and Flash after a long break! I'm bit concerned about the fact that many public computers do not have updated Flash player in their browsers and therefore can't show content designed with CS4 correctly, or at all!
I can't check this myself right now, but if I select ie. Flash version 8 in publish settings using Flash CS4, will this disable all version 10 functionality while designing my site? As far as i know, v10 supports 3D and whatnot fancies, that I don't need atleast for now.
View 1 Replies
Nov 8, 2010
I'm currently looking into selecting and formatting text but I think I need someone to point me in the right direction.What I would like to achieve is this : So after clicking the button: the text "This selected....." should be red. Only red in the output box would be ok too, but preferably in both.
The input text is an input textfield and the output a dynamic textfield.I have been looking into TextSnapshot but this only seems to apply to static text. Using the htmlText property I could input a string with html tags but that's gonna be complicated I guess. Is there any way of achieving this using TextField.setTextFormat() ?
View 1 Replies
Dec 6, 2010
I have 8 MovieClips on the stage each with a different instance name. I made a class called Rebound and linked all the inventory MoivieClips to the Rebound class as the base class. they each have their own unique class.What I'm trying to do is select one of them. when you release the mouse off the movie clip (MOUSE_UP)it goes to frame 2 of its movieclip and making a variable I made up called isSelected = true.but when you click another item in the inventory I want it to deselect the item you clicked first so it goes back to frame 1 and isSelected = false. The problem I'm having is that it selects the first item when you click it. But when I click another the first stays on frame 1 and isSelected stays true. So if I click all 8 in a row they all become selected.[code] if there is something that can choose all of the movieclips that belong to the Rebound class I think I could use that instead.
View 7 Replies