ActionScript 3.0 :: Creating A True Map Implementation With Object Equality (rant)

Dec 8, 2009

I've been spending some of my spare time working a set of collections for ActionScript 3 but I've hit a pretty serious roadblock for the way ActionScript 3 handles equality checks inside Dictionary Objects. When you compare a key in a dictionary, ActionScript uses the === operator to perform the comparison, this has a bit of a nasty side effect whereby only references to the same instance will resolve true and not objects of equality. Here's what I mean:

[Code]...

View 4 Replies


Similar Posts:


ActionScript 3.0 :: HitTestPoint( X, Y, True); Implementation?

Jun 2, 2009

Testing this function and running it 11k times on a shape where I use:
 
shape.opaqueBackground = true;            shape.cacheAsBitmap = true;
 
Is extremely slow.. It seems to take 4 to 5 seconds to check a 101 x 101 tectangular area.I'm wondering how it is implemented...I know the code for the SDK is available?I can 'getPixel' from a bitmap to get the very exact color of that pixel in 1/1000 that time.If I happen to have the bitmap data.But with a shape that is already 'treated as a bitmap' (see above) using hitTestPoint  can stop your system. It should not be vastly inferior to work with Shapes than it is with bmp data..

View 3 Replies

Actionscript :: Use "===" (strict Equality) When Doing Equality Checks?

Feb 19, 2011

I'm wondering if I should always use "===" (strict equality) when doing equality checks... Is there any example of when it is preferable to use "==" (non-strict equality)? In particular, should:

if (param1 == null || param1.length == 0)

be

if (param1 === null || param1.length === 0) ?

View 2 Replies

Flex :: Implementation Of Value Object Design Pattern?

Jun 20, 2011

I am just looking design patterns used in Flex. Any value object design pattern and how is it implemented in Flex.

View 3 Replies

Flex :: Factory Method Implementation To Attain Proper Object

Apr 9, 2011

I've got this issue implementing the Factory method. Following is the snippet of the the main chart class which calls ChartFactory's method to attain the proper object. I Type Cast chartobject so as to be able to call the Show method; I am apprehensive about that as well.

container = new VBox();
container.percentWidth = 100;
container.percentHeight = 100;
super.media.addChild(container);
chartObject = new ChartBase();
[Code] .....

View 3 Replies

ActionScript 3.0 :: Rant On Opacity - Transparency And Hex Values

Jan 27, 2011

(NOTE: I often mix up weather opacity means "fully visible" or "fully invisible". Is Opacity the same as alpha, or the opposite? Just to be safe, I'm using the word "transparency" instead.) Let's say you ask for a color, and I hand you 0x52BD86

Assuming you were wanting a "regular" color, I just handed you a nice little bluish color. However, assuming you wanted a "32 bit" color (that is, including an alpha channel) I just handed you a completely transparent color (0x0052BD86 to be precise), so it really doesn't matter what the visible color was, it's still going to be invisible.That's why AS3 BitmapData has separate methods "setPixel" and "setPixel32".

Would it not be better to have the first 8 bits be a "transparency" value, so instead of 0 being invisible and 255 fully visible, flip them, making 0 completely visible, and 255 completely transparent? That way, if I hand you 0x52BD86, you can basically assume I mean completely visible. Then we won't even need separate functions for 32 bit colors. But, this probably goes deeper than AS3, and likely would mean changing the way color is treated throughout the last couple of years, or? Is there any reason they created the alpha bits like that?

View 3 Replies

ActionScript 2.0 :: Creating A Movie Clip Dynamically And Set The Property _focusrect To True

Jul 31, 2009

I am creating a movie clip dynamically and set the property _focusrect to true

ActionScript Code:
for(var i:Number=0; i<5;i++)
{
var pImage:MovieClip =

[Code].....

I am not able to see the focus rect when i use the navigation keys

View 4 Replies

ActionScript 3.0 :: Set CacheAsBitmap To True On A Display Object?

Mar 15, 2010

I'm actually rendering quite a complex 3D scene (complex is a relative term here, doing a similar scene in d3d or opengl would be a breeze, but they're hardware accelerated so you'd expect that). I've built a 3D engine with some basic features including depth sorting, 3D tweening, and mapping between polar and cartesian coordinates. This last bit should be a give away as to what I'm doing - I'm rendering a 2d grid onto a sphere that I then unravel, spin around, squash, expand all so the Client goes ooh and aah. The trouble, is that on anything other than my workstation, rendering crawls. From discussions with other flash programmers and my own investigations, the slow down is most definitely caused by the rendering itself, and not my relatively swift matrix and sorting calculations (they take around 5-14ms tops depending on the complexity of the scene) .

So, my question is, what exactly does happen when I set cacheAsBitmap to true on a display object? I see no texture map distortion so I'm under the impression that flash automatically splits the cached bitmap into polygons for rendering, but how good is flash at doing this? I don't care about texture distortion on objects beyond a certain z value because they're far away, and try as I might I have found no way of setting the equivalent of a display objects 3d render quality. I'm certain that if I could set such a value, I'd at least double the render speed of my scene by only rendering many polys for objects near the camera. Failing this, is there a way to coerce flash into rendering a low poly object? Perhaps by making invisible any graphically complex children?

View 6 Replies

ActionScript 3.0 :: ButtonMode = True; .useHandCursor = True; Only Works On Half Of The Button?

Sep 4, 2009

about.buttonMode = true;
about.useHandCursor = true;

I have this on a MC I use for a button - and it works but only on HALF of the object - how can I make so it works on the whole object itself?

View 1 Replies

ActionScript 3.0 :: Hittestpoint Returns True Even After Object Is Removed?

Nov 29, 2009

I have six objects which are on the stage when my game loads up. I have stored them in an array in my Document class. Occassionaly I run through this array and check if something has hit these objects and remove them if so. i don't actually remove them from the array though. I'm finding though that even after these objects have been removed from the stage, the hittestpoint still returns true when something crosses the area where these objects once where?! Doesn't the object have to be there for hitTestPoint to return true?

View 2 Replies

ActionScript 2.0 :: Comparing Equality Of Vars?

Dec 7, 2003

Im trying to create a 'simple' check statement for a textbox of type input. I used the following to check whether the user has entered something in the textbox

Code:

if(subject =="" || message =="")
{
trace("please enter something");
}

Simple eh ? well unfortunately if the user hits the space key in both these text boxes this statement validates false ! ..
What am I doing wrong !? lol, I even tried

Code:
if(subject ==null || message ==null)
{
trace("please enter something");
}

and i get same problem.

View 9 Replies

ActionScript 2.0 :: If Condition - (condition1=true) AND (condition2=true)?

Jun 11, 2004

I know how to do this in other codes, but..if (condition1=true) AND (condition2=true) then... How do you do this in AS?

View 5 Replies

ActionScript 2.0 :: Checking Equality Of Two Numbers Not Working

Aug 31, 2009

Got two numbers and need to check if they match up (same value).
this won't fire/doesn't work:
if(codeNumb == exCode){};
But this does work:
if ( (codeNumb + exCode)/2==codeNumb){}
What gives?

View 5 Replies

Flash :: Null Object Reference In ScrollPane/endDrag() When ScrollDrag=true?

Mar 9, 2010

In my flash application, I've got multiple windows which use Scrollpanes. The scrollDrag property is set to true on these because I want that functionality. If I close (within my application) one of these 'windows' and open another, I seem to get a whole lot of this error showing up in my logs:TypeError: Error #1009: Cannot access a property or method of a null object reference.at fl.containers::ScrollPane/endDrag()Sometimes I get thousands of these, which I'm guessing is probably slowing my app down a bit, but otherwise is not causing a problem. Looking through the adobe code for scrollpane, endDrag is really simple:

protected function endDrag(event:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
}

The stage var is the only thing that could be null here.The only thing I can think to do is set scrollDrag=false before the window in my application closes so that nothing is listening for the event

View 1 Replies

Actionscript 3.0 :: Equality Of Input Textfield And String Variable

Aug 9, 2011

I'm testing the equality of an input textfield and a string variable. For some reason, it's always resolves to false even when the values it traces out are the same.[code]

View 1 Replies

ActionScript 3.0 :: If Btn Clicked Goto Label And Make Object Visible False / True

Jan 10, 2010

I have an intropage with two mc buttons that resides in another mc. They are for an English and a Dutch part. So when I click on either one of them, they go to the "Home" label (frame 2). But now at the same time when the main timeline goes to "Home" I want the movieclip container that contains 6 buttons (The English or Dutch ones) to be visible false or true when I click on one or the other. As a part of the code will show some of you there must be an 1119 error that I can't figure out. It has to do with the FrameLabel that is supposedly undifined. [code]If i remove the if statement and just put the visible statement that also gives an error.But maybe the conflict could be that btnTxtFrameN_mc nor btnTxtFrameE_mc exist on the first frame where I wrote the code and only appear as from label "Home" (second frame)

View 9 Replies

IDE :: Stuck In A Loop - Trigger This New Html Page To Open When The X Position Of The Object Is True?

Jan 24, 2009

I have a swf within a html page. There is a function that opens an html page when an object gets to a certain x position. However, when the object gets to that point the new html page (in _self) opens over and over again and get stuck in a loop. Any way to escape this loop and what would be the best way to trigger this new html page to open when the x position of the object is true?

View 1 Replies

ActionScript 2.0 :: FlashVars - Test Equality - Populates A Dynamic Text Field Inside An MC

Jul 18, 2011

Using php to declare a few Flashvars. No problems - they all arrive and behave. One of these populates a dynamic text field inside an MC. Simple enough stuff right? But.... when I try to test equality on that text field I get nothing. I've tried EVERYTHING I can think of. The MC is called "fake2". The text field inside it has a variable name of "choice_dyna" and an instance name of "fd2".

[Code]...

View 1 Replies

Flex :: Null Object Reference After Creating The Object?

Aug 22, 2011

I have one MXML File as

<objecthandles:ObjectHandles xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" backgroundAlpha="1" xmlns:mx="library://ns.adobe.com/flex/mx"

[code].....

View 1 Replies

ActionScript 3.0 :: Creating Object Inside Another Object?

Aug 11, 2010

is it possible to create instance inside method of another instance? But I want new instance to be sibling of instance where it was created.something like this:

ActionScript Code:
parent = new Parent();
childA = new Child();
parent.addChild(childA);

Child class would have this onclick event function:

ActionScript Code:
public function child_click(e:MouseEvent):void {
childB = new Child();
}

I want "childB" to be child of "parent", no property of childA. so I could do:

ActionScript Code:
parent.addChild(childB);

how is this possible without passing "parent" instance as parameter?

View 2 Replies

ActionScript 2.0 :: Read "true" As True?

Nov 18, 2003

I am pulling the words "true" and "false" from a query, but in flash I need them to be the values of true and false, not strings, is there a way to convert this datatype?

View 3 Replies

ActionScript 3.0 :: Selectedcolor, True To The Text True Or False In The False Print Text?

Aug 28, 2010

Selectedcolor, true to the text true or false is false text into print.colorPicker component in, I select Export to a selected color, the color value myMC texte into summer, but accuracy can not control.

var myColorPicker:ColorPicker = new ColorPicker();myColorPicker.editable = false;myColorPicker.visible = false;myMC.visible= false;myColorPicker.addEventListener(MouseEvent.CLICK, clickHandler);myColorPicker.addEventListener(ColorPickerEvent.CHANGE, changeHandler);[code].........

View 1 Replies

Php :: IRC Client Implementation On Web Platforms

Jun 18, 2010

I want to put an IRC client in my webpage. I know there are many clients but not opensource ones (I didn't find any). So, do you know some free and open source projects to implement an irc client on a webpage? I mean is it a good idea to have one made in flash?, one made in html5?, one made in javascript/php?.

View 4 Replies

Actionscript 3 :: Correct Implementation Of MVC?

Nov 10, 2011

All the program does is you click a button and it tells you how many times you clicked the button in a textfield. Document Class: This is the entry point of the code.

[Code]...

View 3 Replies

ActionScript 3.0 :: Errors While Creating Object

Aug 11, 2010

I have created a file in which I have a movieclip which links to AS file.

When I create the instance on timeline it throws the below error. [code]...

View 1 Replies

ActionScript 3.0 :: Creating Instances Of An Object

Feb 22, 2012

I'm having trouble creating instances of an object, I want a random number to be generated and then based on the number which was choosen create an instance of an object in one of four positions.The problem I'm having is, my instances are generated fine but there is one that keeps jumping to x 0 and y 0.[code]

View 21 Replies

ActionScript 3.0 :: Creating Your Own Properties For An Object?

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

ActionScript 3.0 :: Creating The Object Dynamically?

Jan 4, 2010

On library i have mc. In property i made Export for ActionScript. And on timeline add code:

var my_pic_mc:Pic=new Pic();
addChild.(my_pic_mc);

but dont see my movie clip on the stage after compile.

View 5 Replies

ActionScript 2.0 :: Creating BitmapData Object Of Jpg

Sep 4, 2007

I am trying to create a BitmapData object of a jpg that is loaded into a movieClip, so that I can then remove the jpg and have just the BitmapData of the image to manipulate. I have the original image loading into my temporary MC without any problems..and am using a listener to check to make sure that the image has been fully loaded before it moves onto creating an empty movie clip for the BitmapData... but for some reason the BitmapData isn't working as nothing shows up in my holderMC.. and it says the width of the holderMC is 0 when it should be something liek 367 for the 'surf.jpg' test image I am using. My code is below..

Code:
import flash.display.BitmapData;
stop();
_root.createEmptyMovieClip("tempMC", 1, {_alpha:0});

[Code].....

View 1 Replies

ActionScript 3.0 :: Creating Object With Dynamic Name

Dec 2, 2009

I have a xmlfile with some node. I need to create an object of my class for each node. I knoz how to parse xml and get value, no problem here, but I can' create dynamic object with dynamic name...

Here's my class code:
public class Simple_Forum_MV extends MovieClip{
public function Simple_Forum_MV(MV_name:??,title_forum:String,description_forum:String) {
MV_name:MovieClip = new MovieClip();
MV_name.width = 500;
MV_name.height = 50;

View 1 Replies







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