ActionScript 3.0 :: Cloning An Extended ByteArray?
May 20, 2009
I've extended the ByteArray class, like this:[RemoteClass(alias="MyByteArray")]public class MyByteArray extends ByteArray {}and cloned an instance of this class using ByteArray#readObject()/writeObject(). However, for some reason, the cloned object is an instance of ByteArray rather than MyByteArray. This
is illustrated in the following example:
registerClassAlias("MyByteArray", MyByteArray);var b1:MyByteArray = new MyByteArray();var tmp:ByteArray = new ByteArray();tmp.writeObject(b1); tmp.position =
Flash CS5 I wish to e.g create a clone of a text box, I have named the text in properties, I select it and go copy paste in place and it is also with the same property name, so any coding affecting the one will affect that one also. If I rename this in properties maybe I will be ok and ind that it now is seen independently of the original item.
It seems that copy paste creates a linked item, delete or alter the one and the other ones changes also.What's the best way to utilise something you have created and make a clone to then modify this without the source also being influenced by the changes ?
I want to serialize ThugtrisShapes' children (heritage/polymorphism) but his children like Right_LShape take constructor parameters,i have to assign it a default value (in my case null because they receive an Array type), but i get this error even when implementing IExternalizable.
Take Note: IForm extends IExternalizable.
here is a link i found about it but it still does not work...[URL]
Code: public class ThugtrisShapes extends Sprite implements IForm { var squares_:Array; var numsquares_:int=MAX_SQUARES;
[Code]....
I know that not all class' can be cloned , but cloning is an important aspect of OO programming.... There should be a solution for my problem,besides taking the parameter out of the constructor and add a setter.
I am working on a game, made with Flash (using AS3) The game has a fast ball and when this ball hits an object it has to make a sound... but the sound starts with delay (so the ball is far away when the sound is played).This sound is edited by me and it hasn't got any silences at the beginning.The method i'm currently using is the simplest one:
public var sonidoPuntos1:sonidopunto1 = new sonidopunto1()
and then...
sonidoPuntos1.play()
I am trying to introduce the file into a ByteArray and then playing it from there...
I'm writing a class where I load a image with Loader and then tries to copy it into a Bitmap. This goes all and well when I do this in an event but not when I try to make a function of it.
Some code.....
class variables : var imgLoader:Loader; From Main : imgLoader = new Loader();
[code].....
So far so good. but when I try to make a function that returns a copy of the previous loaded image (imgLoader) I get the error :
1067: Implicit coercion of a value of type flash.display:displayObject to an unrelated type flash.display:BitmapData.
The code looks in the function looks like this :
var bm:Bitmap = new Bitmap(imgLoader.content); var bmret:Bitmap = new Bitmap(bm.bitmapData.clone());
Why is this? All I can think off is that in the LOAD COMPLETE event i get a reference of the current target (I think this is the way it works), and are not using the class variable defined at the top in the code.
I have 1 class (that is extending a UIcomponent) that is representing a component. In that component I create different instances of another class that is also a UIComponent but this class doesn't show up in de first class. I see that it is running and that it has the correct hights but I got the feeling that it doesn't show up with this hights. If I trace I see the width and height is 200 X 200 but there is still nothing visible in my component.
I have been trying for an hour to clone an array, It seems that nobody has a true reference on how to do it. Two arrays - movieClipArray 1 and movieClipArray2 I want to duplicate movieClipArray1 entirely so that when I addChild(movieClipArray2[0]), it doesn't take away from movieClipArray1 or reference it in any way.
Don't ask me how, but I've made my Actions Frame way too long and I can't drag it up high enough to size it correctly. Consequently, I'm not seeing the end of my code without adding a whole bunch of empty space.
I just installed flash CS5 and want to link my folder with my extended library classes so they are always linked when I create a new FLA. How do I make a permanent link? Can I also link .SWC files?
I created a movieclip and extended it with my user defined class. Now if I want to use that movie clip and use the properties from the class how do i go around doing that?
I'm creating an object that's only purpose is to hold a few other display objects, so all I need is a super class that can hold display objects. I don't want to use the sprite class because it has so many functions and properties that I don't need. if I can't use DisplayObjectContainer as a base class then what class should I use?
I'm running into the situation where I can't instance a SubClass in the above SuperClass because the SubClass is extending from the SuperClass.
I get stack overflow. Fair enough, right?
Well, I want to add this SubClass to the display, and the only way I know how to do that is through addChild(). To addChild() I need to instance the SubClass.
I can't put any visual display instance or events in this subclass because it's currently null and extends is keeping me from doing so. It's great cuz I can share all the goods, but now I'm stuck dancing inside functions because I can't use events on the main "timeline" of the null SubClass.
I'm working with the Facebook Actionscript API (no PHP or Javascript), and I'm having trouble granting access to extended permissions, like publish_actions. I'm using the following login: var opts:Object = {perms:'read_stream,publish_actions,offline_access,user_photos'}; Facebook.login(handleLogin, opts);
I get two "Request for Permission" windows. The first says my app needs access to "Your Photos". The second says my app would like permission to "Access posts in your News Feed" and "Access your data anytime". Why can't I request access to "publish_actions"? It looks like there may be two permissions levels - regular and "extended". It looks like extended permissions may require a "scope" parameter, instead of "perms". How/where to use the "scope" parameter.
i am developing a kind of (near-)isometric engine (in Actionscript 2.0), kinda simple, which is using MovieClips as wall or floor textures.This is the Wall texture i have:This is what i would like to have:The height is always 1.5 times the width. Its a simple skew transformation.Currently i have two possibilities:I am creating the finished wall in photoshop, save the file as PNG (because of transparent areas). Because i cant import PNGs at run time, i need to create all possible textured walls. A lot of work if i have a lot of textures (Say, i have about 200? )I am importing the original Texture into Flash, and perform a free transform directly in the MovieClip. I still have a lot of work because i have to do this to each textured wall!I would like to do this transformation in Actionscript, so i could import any texture JPG at the runtime (LoadMovie) and just need to have the File names stored somewhere or retrieve them and so on.
I didnt find any possibility to perform a skew transform to a MovieClip in Actionscript..The transformation is just like this: Rotate by 45 deg. (CW) and reduce the height of the finished transformation to 1/2.i am able to apply the _rotation and _height transformations, but the second transformation is always applied to the root object, which often might be very helpful, but right now its not.
Ok, I have spent a little time searching and I can't seem to find an answer to my question, maybe I'm asking the wrong question. here's my situation:
I have a document class called Main.as, this class has variables that instantiate a CreateShape.as class that acts as a superclass. The CreateShape.as class has a protected function that is overridden by other classes (I have a CreateCircle, CreateSquare etc). Those CreateCircle etc classes, use extends to extend the CreateShape.as class, and thus have the ability to override the main method (called newShape()).
I have this problem from time to time with AS3 where I extend a Class and then try call methods and variables which are public from the new class but I get errors that method or variable doesn't exist. My IDE recognises the methods and variables though.[code]When I run the script flash hates it. I thought when you extend a class it was supposed to inherit its properties and methods?Does anyone else have these problems? I shouldn't have to cast it as Box. I swear I have this working in a project but cant see the different in setup?
I am working on a Flex project that is interfacing with physical hardware.Using the AS3 command of socket.send I can set a particular feature on the physical hardware.The problem I am having is I need access to send from the Extended ASCII codes.[code]This would be translated to me sending two numbers to the hardware.7F and 07. The Dec equivalent of these Hex codes are 127 and 7.The hardware takes these two numbers and calculates a length along with a third integer.[code]
Unfortunately the Hex 88 is in the extended ASCII table.The highest the regular goes up to is 7f which is a Dex of 127.I need the ability to send full 0 to 255 numbers in ASCII form.I can't send from 128-255 without using the codes from the ASCII extended table.I get an error every time I try to send something form the extended ASCII table back from the hardware.Can anyone confirm that AS3 does not support the Extended ASCII codes?
I have my main stage, and I have two objects (blocks), these two objects both extend from the "Block" class. The "Block" class is NOT extended from the Main Class.I would LIKE to call a function, in either the "Block" class or in it's subclasses, from the Main Stage Class. The functions will do slightly different things depending which object you are calling the function (Added different things, and different number of things to an array). What is the best way to implement this?
Why Flash creates regular MovieClip object, not instance of extending class? So, I've written a class "test" and put it into "n/test.as" file (as shown on the first attachment). Code: class test extends MovieClip { private var flag:int; public function test() { trace('!!mover constructor!!'); flag = 56; } public function Method():Void { trace('in methdo'); }}
Then I've created symbol in the library, specified it's name and linkage identifier (as shown on the last attachment). Then I've put following code to the first frame: Code: import n.*; var r = this.attachMovie('test', 'test_mc', getNextHighestDepth(), {_x: 40, _y: 0}); trace('ret ' +r); trace(test_mc.flag); trace(typeof test_mc.Method); program_mc.Method(); And I see in output panel that test class property flag and method Method are undefined for test_mc.
I've been doing the course on the flv player and found a tutorial somewhere here about attaching mc and thumbnails with a scrollbar. Now, I can't seem to fine it.Is there creating extended elements to the online tutorial like, adding thumbnails and a scrollbar for the thumbs?
Is there any way to get the mouse location (or at least an estimate), even when it moves outside of the stage area?The reason I need this is that I am trying to detect how fast and at what angle the cursor is moving, not necessarily the location of the mouse. It works fine until you move the mouse outside of the stage area, which happens a lot, and then just doesn't record the mouse location until you move the mouse back on to the stage. Impatience leads to confusion. Confusion leads to anger. Anger leads to the dark side.
Is there a way to hide properties or methods of an extended class?Ie, I want most of the extended properties and methods to be accessible but I want to hide others and use my own instead (not just overriding).
I'm having some trouble with using a Document class in Flash CS3 that is an extension of another class. When I do this, I can no longer make references to MovieClips with instance names on the stage.Here's an example. I have a class called Minigame that extends MovieClip and then a class Shooter that extends Minigame. So the relationship looks like:MovieClip <-- Minigame <-- ShooterI want to use Shooter as my Document class in the Flash file Shooter.FLA. However, when I do this, I am unable to directly access any instance names of MovieClips on the stage of Shooter.FLA from Shooter.as. In other words, if I try to write the line:var mc:MovieClip = this.instanceName;in Shooter.as, I get the error:1120: Access of undefined property instanceName.
I'm new to AS3 and I'm having a problem with an extended class that uses a URLRequest. I have a basic class called 'imageLoader' that I use for loading in external images