ActionScript 3.0 :: AIR Trying To Loop File Properties?
Oct 3, 2009Trying to loop File properties, but loop does not iterate
[Code].....
Why is this? Works for everything else I have tried...
Trying to loop File properties, but loop does not iterate
[Code].....
Why is this? Works for everything else I have tried...
I would like to loop through every property of a movie clip. how to do this and I can only get one level down. If someone could let me know that would be great. here's how I am checking the first level:
[AS]function checkOb(ob){
for (var i in ob){
trace(i+":"+ob[i])
}
}
I have twenty objects in the stage, everyone is name: unit1... unit2... and so on to 20.I wanted to use a loop to modify for example, the alpha values of everyone at the same time. So I used a name like unit1, unit2 so I thougt I could use a loop to assign the alpha values...
"unit" + i.alpha = 0;
i have 10 movieclips mc1_mc-mc5_mc and coin1_mc-coin5_mc on stage i aded listeners in for lop tat is working.when i click mc1_mc i want to make coin2_mc-coin5_mc invisible and coin1_mc and if i press mc2_mc then coin2_mc should wil b visible others invisible.i used folowing code but when i click any movieclip every objects in stage is becoming invisible.
Code:
for (var i=1; i<6; i++)
{
["mc"+i+"_mc"]addEventListener(MouseEvent.CLICK,clicked);
}
[Code]....
I'm trying to figure out a way to use a loop to cycle through all the properties of a DisplayObject and class extended off of it, like in using a for(... in ...) loop on Objects.
View 3 RepliesI am running a for loop to bring in movie clips from an array, and I have a couple buttons that I want to affect the properties of all of the mcs. The buttons (labelsOff_btn, labelsOn_btn, increaseSize_btn, decreaseSize_btn) are only affecting the second-to-last item on the list, although the drag functions targeting the same mcs (thIcon) are working for everything. Code is pasted below:
[Code]...
I was wondering if it was possible to use a for (or for each) loop to trace the properties of an event to the output window. I know I can trace the event in one go, like this:
[Code]...
[Code]....
five instances, five different numbers on theText. Five different names for each instance.
I have 35 movieclips, named s1, s2, s3 etc, depending on the value of currentDisplay, I would like to set a movieclip visible property to true while the others are set to false, I have tried the following:
Code:
for (i=1; i<36; i++){
trace(i);[code]....
but I receive an error message: 1083: Syntax error: dot is unexpected. I assume it is referring to the dot before visible.
I have a little bit of code that makes a nifty kaleidoscope effect, but I would like to take it one step further by having each star in the kaleidoscope gradually shift color as it expands outwards. Right now, I create randomly colored "star" movieclips by drawing 6 different triangles within the movieclip, and then add those individual "star" movieclips to a "stars" array.
What I'd like to do is use a "for...in" loop to grab the .color property of each of the "star" movieclips and change it slightly (using colorTransform?) at each ENTER_FRAME. How can I go in and access the star.color property (or is it star.transform.colorTransform?) of each of the movieclip objects that are now stored in my "stars" array?
Would it be:
Code:
for (var i in stars){stars[i].transform.colorTransform = myColorTransform;
}OR
for (var i in stars){stars[i].star.transform.colorTransform = myColorTransform;
}
So i have my items that I bring onto stage with my loop function with dynamic text fields within the loop. If I want to clear these items using a reset button on the stage how can I do this. From my code below when I press the reset button I receive: TypeError: Error #1010: A term is undefined and has no properties.So a little snippet of my code just to give an idea what I use to bring items to stage and what Im trying to use to reset[code]....
View 4 RepliesI have a flex application which contains different feature that includes google maps, twitter, facebook etc.
Currently I have hardcoded api keys in the code it self but I want to use a properties file/config file where I can put such things and use anywhere I want in the application.
Is it possible to achieve this in flex? I am using swiz framework. Is it possible to achieve this using this framework?
I have done this same thing in ActionScript 3, but am not familiar with ActionScript 2, which I am forced to use for this project. I am loading products into a SWF via XML and attempting to add a click event to each dynamically-created movieclip. Simply tracing the text from a node in XML will do for now. I'd like to assign a property called "desc" or "description" to each movieclip and have it trace that property's value when clicked. Here is the relevant portion of my code as it stands:
ActionScript Code:
var iXML:XML = new XML();
iXML.ignoreWhite = true;
[Code].....
what i'd like to do is create a button, and loop sounds in the "up" state of that button. the only problem is, that if i import the sound to the "up" keyframe and choose loop in the properties it keeps looping until the end of time. what i'd like though is it looping just in the event of the mouse being in the buttons' area. what should i do?
View 6 RepliesI'm loading in files (doc, pdf, etc.) dynamically from an XML file. It is just pulling the link from the server.
Is there I can tell flash the file properties for each file? Like file size, file type, etc?
here is my code
Code:
package
{
import flash.events.*
import flash.display.*
[Code]....
does it have to do anything with ADDED_TO_STAGE event?
what I'm trying to do is make a preloader that will preload about 20 external SWF files before it lets you get to my main file. I want to do this because my main file needs the SWFs to be ready to go once its done loading. I have looked around and i found a few ways to do this with the "if (loadedBytes>=totalBytes)" and the code loops back till the files are done loading... this would be just what i need but i cant seem to get it to work. the file just seems to start loading my files but does not loop and just runs the time-line even once i state what frames i want it to loop.
View 6 RepliesI am working on an enterprise application and creating a base class for some stage components that has knowledge of the class extending it. More specifically, I need a way to loop through the inspectable properties in a class file and place the names of these variables into an array. For example:
Code:
[Inspectable(name="My First Variable", type="String", defaultValue="")]
private var _myVar1:String;
[Inspectable(name="My Second Variable", type="String", defaultValue="")]
private var _myVar2;
[code]....
I have the problem that when I use a component from an existing Flex Library in my AIR project, the values that should be loaded from the appropriate locale .properties file are not loaded. The values are always null.
I am using Eclipse and have created an AIR project that refers to the existing Flex Library (of which I have the source code). When I use a component from that library it calls the following code:
var _resourceManager:IResourceManager = ResourceManager.getInstance();
var res:String = resourceManager.getString('resources', str, params);
"str" and "params" have valid values but res is always null.The properties file is located within the assets directory of the Flex library. I am deducing that the properties file is not being loaded (for some reason). This Flex library works for other Flex projects so it has to be something about the way my project is set up.
I have my compiler settings set to: -locale en_US Is there something special that AIR projects need to do to ensure that they can refer to properties files?
I made a movie clip that is linked to a class named "Fugel". In the "Fugel" class I want to access the object's properties (x, y, rotation, alpha...) that I created in the main FLA file. I'm trying to center it in the constructor, but I don't know how to. The "this" keyword doesn't seem to work.
Here is the code for the "Fugel" class:
Code:
package {
import flash.display.MovieClip;
public class Fugel extends MovieClip {
public function Fugel() {
[Code].....
I am making an application wherein i will need to send the properties of shapes to a text file. That is, its x, y, xscale, yscale, rotation etc. Now the thing is, there could be any number of such shapes. And then, i also need to retrieve those values to redraw them onto the stage.
So how do i go about it? i mean do i create a new loadVars() instance for each shape and send it to the php file? Will that not create a separate text file for each shape?? And how do i get those variables back into the swf? Do i create just one loadVars then or do i create a new loadVars for each shape? How will i know how many to create if there is a separate text file for each shape?
I'm very new to php so i have only a theoretical understanding of how it works. I only need to do the AS part of it.
I have a TextField on stage in a as2 version of Flash. Using the properties panel I'm trying to populate with text from an external file.
The text is in a file called about.txt located in the same folde as the swf.This is the contents of that text file:
info=<p>Established in 2008, Archscape CG Technologies is rapidly building a reputation as a leading provider of architectural visualisations, property marketing solutions and interactive applications. It�s a reputation that�s built on our commitment to quality, innovation and ingenuity.</p></ br>
[code]....
I'm starting to write an app, using localized strings. But I'm getting errors in a properties file, 5 errors, in lines 8 to 12, although there's only one single line in the property file. [URL].
View 2 RepliesIs it possible to load a .properties file from a client computer using adobe flex? I have a flex app that needs to access a server and multiple URLs but the URLs may change frequently. So I think modifying and loading the URLs from a .properties file would be the easiest way update the URLs
I was able to use florians suggestion and I've added the code below if anyone else is interested. I used the example here URLLoader.
public function URLLoaderDataFormatExample(event:Event):void
{
var request:URLRequest = new URLRequest("file:///c:/temp/prop.properties");
var variables:URLLoader = new URLLoader();
[Code]...
I've got a properties file with two distinct key-value pair patters like the following;name.name.name.key = valuename.name.fullname.key = valueAccessing them one by one is fine if the key is known.What I need now, though, is to access ALL values from say name.name.name without knowing the keys (integers to be exact). The values then have to be added to an ArrayList to be displayed in a List.The keys are completely random, so I don't know the range beforehand (I can't and don't want to hardcode the range of range of keys for each single properties file), so simply looping through a previously defined range isn't what I need here. Also, the keys are not successive.
How can I do this with AS3?Just for clarification as this seems to be a little confusing;I do not want to parse the properties file. I rather want to solve this using the methods AS and Flex already provide.The ResourceBundle class already has a method that outputs the content of the specified bundle. However, it contains all values. What I need is just a subset of values that match a given key pattern.Edit:To make this easier, I can drop the key pattern matching and create a new resource file with a distinct pattern. Now I only need to get all key-value pairs (I need both the integers from the keys and the value) from that resource.
I want to load Variables from a .txt-file to edit the properties of a movieClip. For example: 700 is written in the .txt-file. After loading the Clip the x-position of the clip should be set to 700. How can I do this?
View 14 Repliesi have my HTTPService, it looks like this :
<s:HTTPService
id="setCustomerInstalledPackageService"
url="http://localhost:8090/myapp/servletName"
[code]......
So I have a movie clip associated with an external class in the linkage dialog. I put that movie clip on the stage. I have another external class that contains some code (not for the movie clip but for the stage). When I access the custom properties of the class in the actual flash file (not the external code) everything works fine.For example.myMovieClip.explodeTheCode = true;works in the main movie. However, it doesn't work in the external flash file when I have a reference to that movie clip.myRefToCustomMovieclip.explodeTheCode = true fails!It throws an error. In java, I'd just import the custom class the movie clip is linked to and then I can call all the extra custom methods on the movie clip in the external class I want. However, this does nothing. I still can't access any properties.So my question is, how do I access the custom features of a movie clip (that is linked to a custom class) from an external code file. It works in the movie, but not in the external source code.
View 0 RepliesJust been playing around with the tutorials, on the Set properties/Get properties. Everything is all cool, except the "instance name" aspect. I dnt really understand that too well. Is it possible to change an Mc Name dynamically? If you look at my FLA when you hit the top left red button you will get a trace of the mcName as "square". Now if you input a new mc Name on the right hand side, you will see it change on the left hand side. But i want to know why it doesnt remain as the new mc Name, it still goes back to square.
View 3 RepliesI forgot to put it in the title so I'll just place it here; I am using AS 2.0. I know that there are other ways to accomplish the goal that am after, but I was wondering if anyone knows of a way to access the properties of an object's properties?
Here is the code that I thought of, even though it doesn't work
var a:Object = new Object();
a.bproperty = 0; //lowerlevel properties
a.cproperty = 1; // lowerlevel properties
[Code].....
This really just boils down to how I am organizing the code(I have ideas on what do next, and i am 99% sure that I can get them to work), and if there is a way to dynamically access the properties of the objects properties, It will save me from creating yet another large block of code for my project. If you want to see the unfinished project, go to [URL]