ActionScript 2.0 :: Eval Methods - Dynamic Object Name Creation

Mar 9, 2009

I'm having problems with my usual eval methods of creating objects to read off dynamic values programmatically using concatenation. I've found the set command doesn't seem to work with objects that are dynamic....

Code:
function createobject(item){
//create it and store something in it
set ("_root.item"+item.stored, "data storage test for item "+item);
}function checkobjects(){
for (i=1;i<5;i++){
checkit=eval("_root.item"+i);
trace("_root.item"+i+".stored="+checkit);
[Code] .....

Running this produces the output of...
Code:
_root.item1.stored=undefined
_root.item2.stored=undefined
_root.item3.stored=undefined
_root.item4.stored=undefined

How to do this - basically I'm trying to load data, then use that to create dynamic objects and values within it, then I'm trying to work with those values by again using loops to read off the dynamic values during runtime. Obviously if these were "fixed" variables, then it would be easy, problem is that its impossible to use the new Object() command with dynamic names!

Previously I've used this:
Code:
checkit=eval("_root.item"+i+".stored);
trace("value is "+checkit);
Is it my imagination, or was this stuff a lot easier to do in AS1?

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Dynamic Creation Of Movieclip Class, Not Object?

Feb 7, 2005

Is there another way to work with movieclip classes than attaching them from the library?For instance say that I have a textbox class that extends the movieclip class. Puts it on the scene and then I'm free to work with it from the class as I want.But inside this class I check if I need a scrollbar. If I do, then start a "sub-class" and create a scrollbar. I can have a movieclip in the library and attach it and have a new class on it. But what I want to do is write something like this

var clipScroll = createEmptyMovieClip("scrollBar", 3)
clipScroll = new com.texts.text_items.ScrollBar

the problem is if I do like this the class that I start is just an object. I can't trace where it is, I cant create a movieclip inside it and trace where that is.

View 6 Replies

Actionscript 3 :: Object Creation In Flex By Declaring Type Object

Aug 6, 2011

We create Objects in flex by declaring type Object. for example

var objSampleObject:Object = new Object();

and we create properties directly with dot operator without creating any class

[Code].....

My question is in above process is there any class is created internally by flex?

View 2 Replies

ActionScript 3.0 :: Flash Dynamic Eval Of Path Using Array Syntax

Jul 29, 2010

Having a hard time trying to resolve this issue, done a bit a of digging but can't find what i'm after. I'm pretty new to AS3 but know that Eval() has gone and been replaced with [] syntax. However, i'm trying to access a dynamic path to a clip and it seems that the array syntax will not allow more than one variable in a path.

[Code]...

View 2 Replies

ActionScript 3.0 :: Dynamic Swf Banner Creation

Jul 12, 2010

I have a project of dynamic banner creation. The main part of the job is creating a swf on clicking on a "publish" button on stage. A certain movieclip of any width and height on stage must be exported as a new swf file.

View 4 Replies

ActionScript 3.0 :: Any Event After Object Creation?

Jun 10, 2010

I have a class which work with data and I want to do something after its constructorfunction is finished.If a class is a MovieClip, I can do this:

Code:
public function constructor() {
addEventListener(Event.ADDED_TO_STAGE,init);

[code].....

View 6 Replies

Flash :: Dynamic Avatar Creation & Animation?

Nov 17, 2011

A rather large project (rich web application) has fallen into my lap and I am unfamiliar with how to accomplish a major functionality. in the right direction.I need users to be able to customize a 3D avatar and store it on the server somehow. The user can choose a body type, hair style, hair color, clothing, accessories, etc. The user can then choose from a number of different environments to place their avatar into, a specific animation (dance moves, playing an instrument, etc.), and an audio file. The audio file would then play while the avatar performed the animations within the selected environment.

How should we go about doing this? What technology should we use? Ideally, my colleagues and I would use MoCap software (w/ Microsoft Kinect) to complete 3D base models and animations for the avatars. Is it possible to then dynamically skin / texturize the models with the user's stored avatar? If so, how would I accomplish this? Does anyone have any other suggestions on how we would go about solving this problem?

View 1 Replies

Actionscript 3 :: Dynamic Creation And Binding Of Textinput?

Jun 8, 2009

Does anyone have any examples on how to create a dynamic number of TextInput boxes and have each of the text being typed in these boxes be bound to a label? For example, say I have an XML file that specifies that I want 3 TextInput boxes. Flex should then take this data, create the TextInput boxes, create bindable variables for each TextInput and create a label to display what is being typed for each TextInput. The biggest issue I'm having with solving this scenario is how to bind a variable amount of data.

View 3 Replies

ActionScript 2.0 :: Dynamic Variable Creation Through Javascript?

Sep 22, 2010

I am Creating Variables in Flash through Javascript by using SetVariable Method......

Is there any Event like onDynamicVariableCreated?

Can I able capture a event when Javascript create and sets a dynamic variable in flash?

View 1 Replies

ActionScript 2.0 :: Dynamic Multidimensional Array Creation

Jun 22, 2006

var Array1:Array = new Array(5); // where 5 is length of array
for(i=0;i<Array1.length;i++)
{
Array1[i] = new Array();
}

Above code will generate dynamic array of multidimensoal array.

View 2 Replies

Actionscript 3 :: In Flash Does Extending An Object Use More Memory Even If The Object's Methods Aren't Used

Jul 20, 2011

I am creating an object pool to cache some recyclable objects in memory at the outset of my application in order to avoid (as much as possible) the performance issues caused by GC running; if possible I'd like to minimize the memory my object pool reserves, so I'm attempting to pool generic forms of the objects (with no methods) and then casting the generic variants to more specific and complex object types which extend the generic form when I actually want them on the stage.

The trouble is that to do this requires the generic variant class to import/extend MovieClip (because the more complicated objects are themselves MovieClips and make use of DisplayObject methods)-- does simply importing and/or extending a class add to the memory an object takes up when instantiated even if it never uses methods from the inherited class? It makes sense that it would, and some light profiling seems to suggest that it does, but I'm not 100% certain. About how large should an 'empty' MovieClip instance be in bytes?

View 1 Replies

ActionScript 3.0 :: Object Creation Within Defined Area Only

Jun 9, 2010

I have a .fla set up right now that places ball randomly around the screen. However I would like to be able to set the coordinates of the range for the objects(particles) placement to the boundaries of a shape. I am starting with a circle for the moment, but I can't figure out how to set the range of object placement to that of an MC. I was planning on somehow calculating this out but I am stumped. Is there a better way for me to draw a shape, and somehow use a mask in as3 to define where the particles can no be placed?

View 21 Replies

ActionScript 3.0 :: Skip The Creation Of A Data Object?

May 11, 2009

I'm in the early stages of writing a rather complex app that grabs data from a database (via PHP bridge) and builds out content from it.This app is going to be a very visual timeline of sorts, with different entries of many types (images, audio, video, text, etc). Each entry type has some common properties (ID, location, date, etc), and some unique (imageURL for images, audioURL for audio, etc).When creating these objects dynamically, should I:

A) First read the data from the database, assign that data to a new object that contains *just* the data, and then pass that data object to the constructor of the visual representation of that object when instantiating the specific object of that type? Or,

B) Skip the creation of a data object, and instead pass the data property by property to the specific object class.

For instance (very roughly),

A)Code:
// receive queries data here
var newImageData:ImageData = new ImageData(imageURL, headlineText, captionText); // put data into data object
var newImageEntry:ImageEntry = newImageEntry(newImageData); // create new visual object, passing data object

B)Code:
// received queried data here
var newImageEntry:ImageEntry = new ImageEntry(imageURL, headlineText, captionText); // create new visual object directly

I won't be creating the visual representation of the object immediately, so I feel like I have no choice but to map the data to a data object first....but is there another way? Should I try to merge the two, so that an ImageEntry object can be created as the data is received, but then a separate call to that object would be required to actually create the visual representation of it when needed?In the past -- which apps quite a bit simpler -- I've simply mapped all the data during the XML parsing to dynamic objects that act only as containers for the data, which is then passed to a different object to create the visual representation of it...

View 5 Replies

ActionScript 2.0 :: Dynamic Menu Creation Via A Text File?

May 22, 2003

I'm a Flash MX action scripting newbie. I'm trying to create a dynamic drop down menu system that reads a text file to create the items listed in the menu. I've been reading tutorials and trying to break down source fla files to understand how things work. I'm stuck on what the following block of code means.Would it be possible for someone to break down the following code for me? It references menudata.txt to create the drop down menu. I can successfully modify menu.data.txt to create more menus and change the titles in each button, but creating sub-nav is totally kicking me in the arse.

The code follows:
item_spacing = 18;
x = 1;

[code]....

View 1 Replies

ActionScript 3.0 :: Movieclips From Library Versus Complete Dynamic Creation?

Jun 6, 2011

Does anyone know if there is a serious performance increase if I were to instantiate say, 4000 objects from the library instead of creating them purely in a class?Also I know very little about garbage collection and testing performance

View 5 Replies

ActionScript 2.0 :: Dynamic Menu Creation And Duplicate Movie Clip?

Apr 25, 2005

The menu will consist of Main headings and Sub headings that will appear when the Main headings are clicked.The Headings are displayed within movie clips that are generated via duplicateMovieClip()I have attached actionscript to the timeline of a movieclip and it loads and displays the Main headings with no problem.On the one movie clip that I am duplicating, I have an on(press) action that is supposed to generate the Sub headings using the same duplicateMovieClip technique. This is where I run into trouble. I cannot get the Sub headings to generate. Can you specify duplicateMovieClip() within the on(press) function of a movieclip that was already duplicated?

View 1 Replies

ActionScript 3.0 :: Bitmap Creation After Display Object Internal Script?

Aug 11, 2009

I have an MC being duplicated to 2 bitmaps but they are created before the MC performs its internal script. How to change that order? See sample .fla.

View 2 Replies

ActionScript 3.0 :: Dynamic Asset Creation - Make Database Driven Applications

Feb 9, 2011

I have been using AS3 for approximately 1 year now, and although I havent really done any major projects with it, I am fairly confident using it. However, There is 1 part that I am very curious about. At the moment, I am using the design section of flash cs5 to create my assets. I am trying to make database driven applications, and the problem I have run into with using the design section is that you must manually program each symbol.

For example, If I wanted to make a dropdown menu, and a php file was passing the variables such as "amountOfSections = 5", Then 5 sections would be displayed. This is fine to do using alpha to control what is visible etc, but if there where 5000 dropdown menu items, I would have to physically place 5000 dropdown items onto the stage. I know that it is possible to use as3 to create objects AS THEY ARE NEEDED, but I have no idea how to do it.

[Code]...

View 14 Replies

ActionScript 3.0 :: Eval - Making Dynamic Post Values To Post To A URL

Jul 15, 2010

I am making dynamic post values to post to a URL.

[Code]...

Maybe I am doing this the hard way with eval, is there an easier way, such as passing an array of post variables?

View 3 Replies

Actionscript 3 :: Use Sound Object Methods On FLV?

Mar 22, 2010

I'm recording and playing back mic input using Flash Media Server, and even though it's just audio, we're saving the output as FLV. I'd like to get a waveform of the recorded audio. Ideally, since we already have a lot of saved/recorded audio, I'd like something that can take a loaded FLV and get the waveform, as opposed to generating it at record or playback time.

AS3 has the new Sound.extract() method that can be used for this (plenty of online tutorials), but it seems like it only works for MP3. Is there a way to use this method on FLV audio? Or is there another to extract a waveform from a FLV?

View 1 Replies

Actionscript 3 :: List All Methods Of An Object?

Sep 30, 2010

How do I get the list of all methods from an object? I know I can get the object class in this way:

var className:String = flash.utils.getQualifiedClassName( myObject );
var objClass:Class = flash.utils.getDefinitionByName( className ) as Class;

In JavaScript I can iterate over the prototype of an object to get its properties and methods. Is that possible in ActionScript 3? Do you any good source for metaprogramming/reflection over ActionScript 3?

View 2 Replies

AS3 :: Flash - Accessing Object Methods Given As Value In Dictionary?

Nov 17, 2011

So I am writing a program which uses Dictionary to store objects. For example

var dictionary:Dictionary=new Dictionary();
var myObject = new myObject(var1, var2, var3);
dicionary["key"]=myObject;

where var1, var2, and var3 are simply means of assigning values to variables in myObject.can I access values or functions that are found in myObject? In myObject class I have some getters and setters. Can I use a getter to get the value of var1 for example.

dictionary["keys"].getVar1()?

View 1 Replies

ActionScript 3.0 :: Calling Methods On Javascript Object?

Oct 27, 2010

-I know one can call javascript functions from as3 using ExternalInterface, but in all the examples I've seen the function has been a standalone function on the page. Can methods on objects (that are on the page) be called. E.g: obj.someFunc() rather than just someFunc()?

-The return value can be stored as well using ExternalInterfaces. Can this return value be a javascript object? If so, its methods be called from it directly?

View 6 Replies

ActionScript 3.0 :: Flash Class Object Calling Methods

Dec 7, 2009

I have a class file named Main.as and another class called icon.as

package {
import icon;
public class main {
public var _time:String;
function main() {
[Code] .....

How do I get the current update from the main class without calling the MainObj repeatedly. Is this possible in Flash AS3, or any other alternate method for this idea.

View 2 Replies

Flex :: Data Access Object Or Inline Methods?

Jan 28, 2011

I am still very new to Actionscript and have an okay working knowledge of Flex. I am working on an AIR application that runs a SQLite database underneath. The database is only 3 tables (projects, items and types). I was wondering if Actionscript best practices are to use a data access object or layer to store all of my database functions or to just run them inline as needed. I would assume an access layer would be best for interacting with the database for usability, but I can't seem to find much documentation for SQLite in AIR.

View 1 Replies

ActionScript 3.0 :: Direct Methods Access Of Interfaced Object?

Jun 18, 2009

My situation like this:IHost.as:

Code:
public interface IHost {
function doSomething() : void;

[code]....

View 2 Replies

ActionScript 3.0 :: Bitmap Creation "after" Display Object Internal?

Aug 11, 2009

I have an MC being duplicated to 2 bitmaps but they are created before the MC performs its internal script. How to change that order? see sample .fla

View 2 Replies

Actionscript 3 :: Object Memory Usage With Static Vs. Instance Methods?

Nov 17, 2010

This has been a long-standing curiosity of mine, and I haven't gotten around to profiling to find out, and haven't seen it asked yet (for AS3):Let's say that I have a class:

class MyClass {
public function myMethod():String {
return "some return value";

[code]....

View 1 Replies

Flex :: Adobe - ArrayCollection - Accesing Object Methods / Attributes?

Jun 18, 2011

Maybe i didn't get the real meaning of the ArrayCollection, but first of all some code

[Code]...

View 1 Replies

ActionScript 2.0 :: [Flash8] Setting Callback Functions On An Object Methods?

Jan 12, 2006

Been doing some actionscript magic lately, done a nice interpolator class. The class, whenever an update occurs, calls a previously specified callback function. Normally, setting a variable of funCallback:Function and calling it works fine. However when I wanted to specify an *object's method* as the callback for the interpolator, it apparently called it as if it would be a static method.

And it isn't.What I need to do, simply speaking, is to be able to call an object's public method, having just th object's reference and function name, just like the second variant of setInterval does ( the one having "object, string" as the first two params, not "function").

View 12 Replies







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