ActionScript 3.0 :: Empty Display Object Properties?
Aug 20, 2010
I don't know if i am saying it right, but i want to take out(empty?) a display object properties.Instead of manuallyQuote:
trace(displayObject.x);
trace(displayObject.y);
trace(displayObject.width);
[code]......
View 2 Replies
Similar Posts:
Aug 14, 2011
I'm doing some Actionscript work right now and I'd like to know whether there's a way to initiate an empty object's value programatically like this:
var myObj:Object = new Object;
myObj.add("aKey","aValue");
To add a property called aKey whose value is aValue.I need to create a "Dumb" (data-only) object to use as a parameter to send via POST. So I don't know offhand how long and/or how many attributes it's gonna have.
View 1 Replies
Oct 21, 2009
Is there a simple way to completely empty a display object container regardless of what it contains, including if it's already empty? In other words, without determining its children and using removeChild on each?
View 2 Replies
Aug 12, 2010
In the documentation for DisplayObject, it states that the width and height of the DisplayObject can not be changed if it is empty. Why is this restriction necessary? In every other framework I have used, you can resize containers that are empty.
View 2 Replies
Feb 13, 2010
As far as I know, a pixel is a pixel. You can hardly move a DisplayObject half a pixel, can you? Still the x and y properties of a DisplayObject allow values with two decimals.
A small test..
PHP Code:
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(e:Event):void {
myDisplayObject.y = Number(myInputBox.text);
trace(myDisplayObject.y);
}
Shows that this happens in steps of five (0, 0.05, 0.1, 0.15, etc.).
Values like for example 0.16 get converted to 0.15.
Also, the object moves 1 pixel as soon as it's x/y value is .2
You would expect the x and y properties to convert the given numbers to integers, no?
View 3 Replies
Jun 25, 2010
i'm attempting to cast an object's property as an actual property of another object. here's my object variable: var propObj:Object = {prop:"width", width:50}; now i want to assign the property of a sprite using that object's properties. var sp:Sprite = new Sprite(); sp.(propObj.prop as Sprite.property) = propObj.width; now, i'm not even going to try that because i know the compiler will explode all up in my face. but you should be able to see what i'm trying to do. why i'm trying to do it is because i'm reading in an XML file with an undetermined list of usable properties for specific objects. so instead of writing something like a huge switch statement to evaluate whether the XML file has a value for that specific property, i'm trying to assign properties dynamically based on what's available in the XML file. if what i'm trying to do is possible, what's the best way to do it?
View 1 Replies
Jan 30, 2008
I 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]
View 3 Replies
Jan 31, 2010
If I create a rectangle with 100px width and 100px height and then rotate it, the size of the element's "box" will have increased.With 45 rotation, the size becomes about 143x143 (from 100x100).Doing sometimes like cos(angleRad) * currentWidth seems to work for 45 rotation, but for other bigger angles it doesn't.At the moment I am doing this:
var currentRotation = object.rotation;
object.rotation = 0;
var normalizedWidth = object.width;
[code].....
View 4 Replies
Nov 12, 2010
I wonder if there's a more straightforward way to achieve this.[code]...
View 3 Replies
Jul 13, 2011
how in Flex can I display a message within a Spark List component that states that the List is empty. For example if I have a List showing number of jobs outstanding, if my List is empty then I want a message displayed across the List stating "there are no jobs to perform".
I'd rather not use an Item Renderer because then it's an Item (the list is not empty) and the item can be selected.
View 2 Replies
May 17, 2005
Allright, i receive a string and want to convert it to object. here a test that i have made:
[code]....
this work pretty fine... but i am receiving the object property as follow: "{a:'test',b:'testAgain'}" How can i easily convert it to object properties?
View 4 Replies
Nov 11, 2007
I'm basically loading an XML file to assign instances of a movie clip a distinct value, which it uses to modify its height. So, I'm looping through the xml and instantiating my class Object each time (Rect) and then placing that Object into an array:
Code:
function loadXML(loaded){
if(loaded){
var boxArray:Array;
xmlNode = this.firstChild;
[code]....
the trace here always comes up undefined. "listPosition" in this bit is an Rect parameter, defined in the previous bit of code as "i", so I can keep track of the order of the stack.I've found one or two examples of putting objects into an array and getting them back out, but it doesn't seem to work with this, maybe because I'm using a class. I don't know.Could this be an area where I need to use the array access brackets, like around the movie clip the object is loaded into. I've tried everything I can think of -- referencing back to the movieclip, adding extra objectRef type parameters... nothing has worked yet.
View 3 Replies
Mar 28, 2011
what are the display:blending properties of buttons, shown in properties panel.my problem is the button expands its size in most of these modes, except in darken and others, which change the color.i need my button to not change shade and to stay the size of the area i converted to a button.
View 2 Replies
Mar 9, 2011
Is there anyway I can display exponents or fractions properly in a textfield.
I'm creating educational software and want to see actual symbols as opposed to: 3/4 or x^2
View 1 Replies
Oct 26, 2009
I want to check in my function if a passed argument of type object is empty or not. Sometimes it is empty but still not null thus I can not rely on null condition. Is there some property like 'length'/'size' for flex objects which I can use here.
View 6 Replies
Mar 6, 2008
Is there any way to test if a display object has been added to the display list?
View 9 Replies
Jan 22, 2012
can I resize a display object (container) without its contents (children) are resized?
For example, in the following code when I resize the green square, red is also resized. I wanted to resize only the green.
ActionScript Code:
import flash.display.Sprite;
var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0xff0000);
[Code].....
View 3 Replies
Mar 4, 2011
What's a simple way to detect if a display object is currently on the display list?
View 1 Replies
Aug 14, 2009
Can you make one Bitmap Object (I'm using an external jpg) or something similar, and then display it many times simultaneously without creating a separate object each time?
Also, would they be easily removed or hidden?
I've got a little checkmark jpg graphic loaded here, but I'm not sure how to go about using it in many places at once.. I can only display it in the one place at any one time...
I'm thinking there might be a way to load the picture once, then use its bitmapData elsewhere in new display objects somehow, without needing to reload the image over and over?
View 3 Replies
Feb 9, 2009
It's my understanding that a display object cannot be in the display list more that once.So if I add something to the stage shouldn't a second addition of the same object replace the first? for instance:
[code]...
there should now only be one "myDisplayObject" on the stage.
View 3 Replies
Jun 27, 2011
How can i cast a object to another type? in AS3 i tried putting (objectType) infront of the variable but it doesnt work, below i have added objects of fishes into the child, and i am getting the fishes back out when mouse down is triggered, and then calling the fishes what to do. however i cant call the method of the custom class fish because it is a displayobject.[code]...
View 1 Replies
Sep 4, 2008
how to trace all properties of an Object regardless of data type?
View 4 Replies
Jul 7, 2011
I'm doing some work with JSON in as3 using as3corelib (very useful) and was wondering if it is possible to get an object if all you have is one of its properties, also an object. Here's an example of some JSON:
"parentObject": {
"propertyObject": {
etc.
}
}
so what i'm asking is, if I have propertyObject, can I access parentObject somehow?
View 2 Replies
Sep 11, 2008
Back in the day (AS2), I used to create what I called an"ivar" property that collected the index of a series of buttonsthat were clickable (see attached code). Imagine 10 buttons on thestage with names (selectButton0, selectButton1, ...selectButton9).The code under the //----------BUTTONS header would make a propertyof the button that was clicked, call it "ivar" and then send it upto a function that would use it as an index to then load theappropriate content with MovieClipLoader (remember that Class?).I have tried something similar in AS3 without any luck sincethe whole button thing is now steered by events. Does anybody knowan elegant solution that would achieve a similar result. That is,click a button called "selectButton0" and have returned the zero asan index variable that could be used further?
View 14 Replies
Sep 30, 2009
I would wish to create a class extending Object class to create it's own properties in a FOR loop to save some space. However, it seems impossible...
The following won't work:
[Code]....
Is there a way around it so an object can create it's own properties using functions?
View 1 Replies
Mar 1, 2012
Does anyone know how I could remove properties that have been set on a static object in AS3? it would be something like -
foreach(property in GlobalStaticVar.properties) {
GlobalStaticVar.removeProperty(property);
}
View 1 Replies
May 4, 2010
can i modify the property inside its class, and then get it from another class with the modification done on it?
View 1 Replies
Jan 4, 2011
I have an object that I'm creating as such:
ActionScript Code:
public static var places:Object = new Object();
places["MyHouse"] = ["My House", new Point(PointX,PointY)]
places["YourHouse"] = ["Your House", new Point(PointX,PointY)]
[Code].....
View 0 Replies
Feb 16, 2012
Is there something that will let me trace all of an object's properties? (and wow typing the message before coming up with a title makes a difference)
View 1 Replies
Dec 12, 2002
I am having a hard time understanding for...in loops. I have seen David use it in his signature, and I understand what the loops is doing, but only from the context of the rest of the signature. If somebody could explain how the for..in loop works, I'd be greatful. Here's what I know:
PHP Code:
for (proprtyThing in objectThing) {
trace (proprtyThing);
}
My understanding of this loop tells me that if I run it, I'll get a list of all the properties of the object named objectThing....but this makes no sense to me!!
View 12 Replies