ActionScript 3.0 :: Accessing Elements In Xml
Nov 17, 2011I have the following descriptive xml and code... the code doesn't work as it should be
[Code]...
I have the following descriptive xml and code... the code doesn't work as it should be
[Code]...
After quite some time I finally decided to pick up Flash again, this time taking the OOP route. I'm a bit rusty though, so I'm stuck on something pretty basic.Here's my Layout of relevant objects and scripts:
Stage > gunAmmo (TextField)
Stage > player (MC) > pistol (MC)
........ > player.as > pistol.as
As you might've guessed, what I'm trying to do is set the gunAmmo.text property from within my pistol class. I've tried using MovieClip(root).gunAmmo, stage, etc., but neither seems to be working. I sort of get why, but I don't know what the correct syntax is. (And yes, the TF's instance name has been set correctly.
I have a movieclip, with the instance name SizingBox, on the main timeline. Within that mc, I have a Slider component, with the instance name Sizer. I want to declare an action listener on the main timeline which will listen to changes for Sizer and do something based on the current value of the slider.In AS2 this was really easy, but I cannot seem to figure it out for AS3.
Code:
var X = SizingBox.Sizer.value;
this code gives an error.
[code]......
I am working on a information visualization project that involves visualizing json data from online forums. The problem that I'm having is that I'm not able to access all of the values of elements the json. Here is my Schema:
[{"course": "compsci 101",
"forums": {
"forum": {
"forum_title": "Week 11 - Cable and the Specialization of Television",
"forum_word_count": "1000",
[Code] .....
I tested and the json is valid but when I run it with this code it only is able to pull the last value (Week 2 Discussion 1 - Cable and Broadcast Television).
for (key in tuples) {
trace("forum title: "+ tuples[key].forums.forum.forum_title);
}
So, my question is, why isn't it tracing all of the values for the forum title? and what do I need to change to access those values?
Is it possible in Flash 8 accessing from the linkage class, associated to a component, the graphics elements (for instance, a standard UI component, like a tree or a comboBox) that are on the movieclip this class refers to?
View 1 RepliesI'm trying to link a clip to a class, and it goes well until I try to access MovieClips or TextFields placed on the stage within that clip from code in the class. My code is below; there is a TextField called output_txt on the stage within this clip.
class Main extends MovieClip{
public function Main() {
//trace("123"); <--if I replace the line below with this, it traces nicely
output_txt.text = "123";
stop();
}
}
I've used the GUI to create a rectangle that I turned into a button symbol (SimpleButton). I then edited the button so that it had 4 different button states and a text layer on top. I then created a class definition file for this object so that I could dynamically change the label text (the text layer) when adding instances of this button to the stage.
I was able to create and link a class file (DynamicButton.as) just fine, but when I try to access the text field that I created on the button, I get the error:
"Access of possibly undefined property btnLabel through a reference with static type com.examples:DynamicButton."
when i couldn't get that to work, I decided I'd try adding the TextField directly within the class definition file, using the following code:
package com.examples
{
import flash.display.Sprite;
import flash.display.SimpleButton;
[Code].....
The problem is that I can't seem to add the TextField to the SimpleButton, as it's not a display object. So, I tried adding it to the parent of the simple button (and I figured, I'd just place it exactly above the button). But then I get a "null object reference." error.
is there a way to access GUI-created elements from w/i a class definition file? How would I add the TextField to the button using only AS3 inside of a my class definition file?
Is it generally to position elements relative to other elements or in absolute values?
View 2 Repliesdoes anyone know how to shift all the array elements by one or more without deleting the array itself?
Something like rotating the array:
1,2,3,4,5,6,7,8,9,10
10,1,2,3,4,5,6,7,8,9
9,10,1,2,3,4,5,6,7,8
8,9,10,1,2,3,4,5,6,7
7,8,9,10,1,2,3,4,5,6
When i create a menu, the dropdowns go behind the flash element. But in some sites, like Digg, it is shown above. z-index is of no use
View 2 RepliesI made a .as Class where some graphical elements are spawned into the stage. However, the Flash (.fla) have some internal graphics that are supposed to be over the graphical elements spawned from the custom class.I tried to make another layer over the layer where the as3 Class is being called, but unfortunately it doesn't do anything, the graphic from the .as still appearing over the internal .fla graphics.
View 2 RepliesI am reading up on 3d and wonder what new elements did they add in cs4 to 3d?? or nothing special.basically write 3d pre cs4 method or there something new to know?
View 3 RepliesI work in Adobe Flash cs3 and as2. First I have flv file no1 it contains buttons, animations, imported sounds and fonts, lot of layers, preloader and its all mixed on stage (its a kind of meny for a web page). Now Im working on flv no2 in which all the elements contained in flv no1 are represented as a small picture (button) which should call (make it visable like zooming that object) some mc that contains all the elements from flv no1 and working as they do in flv no1. how to pack all the elements in flv no1 in a form of movie clip and import it to flv no2 and preserve all the functionality.
View 1 RepliesI would like to know if flash can allow the user to arrange elements (in a published swf) on the stage and "lock" their positions so that if the swf is reopened or reset, it will retain the new arrangement. How would you describe this feature?
View 1 RepliesHow would I make only some elements of my movie resize to fit the screen?For instance: I have a 2000 px wide movie and inside it a centered 1000px wide MC which will aways fit the screen while other elements (the background for examle) won't resize.
View 5 RepliesI'd like to ask the following question: for instance, I have a scene in 3ds max with 10000 textured cubes. Is it possible to export this .max scene to Flash and create a .swf application, in which user will be able to rotate, zoom the scene and also select a particular cube and all this done without visible PC slowdown? After some googling I found that Papervision3D is a good tool for working with 3D in Flash.
View 3 RepliesI want to load data from a text file with four elements (account, first name, last name, club status). There are 88,000 accounts.
[Code]...
I have one .swf containing an image.I also have a .swf containing elements such as a logo, all in movieclips.I need a way to load the image .swf into the second .swf, but have the image placed underneath all other elements.
View 3 RepliesI've created a form with 4 input text fields taken from the components.I've tested it and I've seen that pressing tab the cursor doesn't move through the correct input text order but it does like this:1st field2nd fieldsomewhere else (I can't see where)3rd field4th field
View 3 RepliesI'm fairly new at flash development but here goes: is it possible to use xml to drive the layout of a flash website in CS3? Perhaps using ActionScript 2 or 3? In particular, I'm looking to be able to for e.g. create a news ticker where changing the XML allows you to 1) change the text and appearance, 2) framerate can be controlled, 3) interpolations between key frames can be specified (e.g. linear interpolation)
View 1 RepliesI had no problem working with xml in cumbersome AS2, but apparently it's menat to be easier in ASŁ, however I'm having a problem getting the data from this piece.
Basically I need to be able to access the id & src.
At the moment I can only parse a certain depth of XML elements, and I was wondering how you could get the deepest XML element, because at the moment I have a series of for each loops that loop through xmlElem.children() but this only allows me to parse to a certain depth, so it's rather limited.
View 2 RepliesI want to get all xml elements (xml descendents) which have some attributes like:
<books>
<book concept="rr" author="xx"/>
<book concept="tt" />
<book concept="yy" />
<book concept="uu" author="xx"/>
</books>
I need to perform a xml descendent search for xml nodes with author attribute containing
results should be:
<book concept="rr" author="xx"/>
<book concept="uu" author="xx"/>
I got a Flash AS2 website and I need to get all the buttons inside an instancied movieclip (to define an specific property for each one). I've been searching for an hour or more, but I just got solutions for AS3
View 2 RepliesI have a MenuBar, which is using a XMLListCollection object as a dataProvider.I wish to add and remove elements from this collection at runtime.How to add / remove elements from XMLListCollection ?
View 2 RepliesI would like to know if its possible, to use a string in order to create a UI element.I think many people have this kind of problem, they want an easy setup in flash to generate a dynamic UI, through code.It should look like this (pseudo code):
addToStage("Button","add");
addToStage("TextInput","name");
private function addToStage ( o : Object, str : String ) : void {
[code].....
I'm having a bit of a problem loading in xml into my flash document. Current my file loads in thumbnails and if you click on those thumbnails the full size version of that loads on the screen - you save it - and it writes to the database. If you come back to this application - I want it to load the photos that you saved to the stage last onto the stage again. There are 5 photos that should be loaded - but for some reason only the first one is loading. The xml looks like this:
Code:
<items>
<item id="2" type="body" src="body/body/body_2.png" />
[code].....
I'm working on a site which is loading different swf to a main file. For that i have a script which is calling my six swf from six button. I'm also having a basic sliding animation in actionscript when I change page.
Everything works find but now for this project i want to place 3 element which are going to stay on top of the swf. This is the tricky part for me as i'm a novice to AS3. I searched for few days and i find maybe 2 ways to do this.
the first one would be to upload the external swf to an empty movie clip which would be place under the other elements. So i try to use an addChild(); on the button action but it just duplicate the swf (one on top same as before and one into the movieclip) and the animation is not working within the movieclip.
after i try to place the swf to load on the lowest level with a movieClip(root) but i don't know where to place it within the script to make it work correctly.
This is the script i'm using:
import fl.transitions.*;
import fl.transitions.easing.*;
//Assign CLICK listeners for each menu button
btn1.addEventListener (MouseEvent.CLICK, buttonClicked);
btn2.addEventListener (MouseEvent.CLICK, buttonClicked);
[Code]....
How do you empty an array. I want the array complete empty, so the array length =0. I have tried this code, but that doesn�t take away all elements in an array, just a few.
for (i=0; i<myArray.length; i++) {
myArray.pop();
}
What is the easiest way to let a variable refer to all the elements in an array?
View 3 Replies