ActionScript 3.0 :: AddChild Inheritance - Object Preserve It's Initial Alpha?
Dec 23, 2010i have this: object1.addChild(object2); object1.alpha = 0,5; How can object2 preserve it's initial alpha?
View 5 Repliesi have this: object1.addChild(object2); object1.alpha = 0,5; How can object2 preserve it's initial alpha?
View 5 RepliesI am trying to move a 'Shape' object across the screen. As the object moves, a copy is being left at the initial position. Almost as if only an instance of original object ahs been moved
This is not an issue for moving an image or MXML graphic. Is something wrong in setting to the move object?
The code is as follows
private var arrow:UIComponent;
private function resetAssets():void{
arrow = new UIComponent();
[Code].....
[URL] i want the object to fade out but in the object there's a lot of overlapping pictures and each becomes half transparent. how to make the movieclip to change the alpha as it was without objects?
[Code]....
I am writing a simple application which communicates with web services a lot So I am listening for success and fault events very often. When service returns a fault, I show an alert to a user saying something like: "Sorry there was a problem with a service, we will try to call it later"
But there is a problem. When user didn't notice an alert, and service is still dead before the second call the alert will be shown again, and again and again (so There will be very many alert objects which is bad)
I want to make alert a kind of singleton. So I am trying to produce a class something like
[Code]...
Base extends MovieClip document class extends Base how would Base properly access a display object which is already placed on stage in the flash ide? for example creating the var in Base's class definition = 1152: A conflict exists with inherited definition in name space public. but just referencing the var = 1120 undefined property , as the item is only a variable of the document class Is the only approach to let the classes load, then create the display object rather than have it on stage already?
View 6 RepliesI'm having some troubles with the use of interface and inheritance in AS3. I've done lots of OOP in the past and what I'm trying to do seems obvious to me, but doesn't work in AS3. The question is : Is it possible to override a function that return an Object of class A, and make it return an Object of Class B which extends A ? It seems not to be possible, since I'm getting a signature error in Flash, when compiling. For example, the following set of class do not compile (the code in function definition doesn't matter):
[Code].....
The issue i'm having is that i want to have dispersed code-generated stars, and then they form a form (reindeer, santa, etc).
The idea is how i make the stars disperse and then return to their previous positions, knowing that the initial positions were randomly generated as well.
I am developing a drag and drop functionality and take a JPEG screen shot of droped objects. my problem is. when i drag and drop an object the object jumps off some distance.. i am unable to clear tat.. Below is my application.as file
[Code]...
I have a swf file that loads into my main movie, and within that swf there is a masked image that i would like to scale using zoom in and out buttons and also by using a slider bar.However i cant find any tutorials that will allow me to combine the two.I have used the following code for the buttons. Which seems to work ok but i would like it to be a little smoother. (using speed or some sort of easing??)
ActionScript Code:
zoomPlus.onRelease = function(zoomIn) {
if (test_shirt.shirt._xscale == 400 && test_shirt.shirt._yscale == 400) {[code]....
but for this code it keeps shrinking my initial object down to 10 pixels by 10 pixels..
I've seen code where an object can be added relative to another but I can't get it to work. I'm just trying to draw a rectangle and then add another smaller rectangle relative to the first
public var rectangle:Sprite = new Sprite();
public var other:Sprite = new Sprite();
rectangle.graphics.beginFill(0xFF0000);
[Code].....
Both rectangles just end up rendered relative to the stage.
I would like to add the same object to two different movie clips but flash wont.I have movieclip1 and movieclip2, now I want to load an external picture and add it to both movieclips. Then the following code does not work.[code]My question is: how I can add the ImageContainer to both movieclips and manipulate them separately ?
View 3 RepliesCode:
var rockSpawn:rock;
function doCollision():void
{
trace("collision detected at "+collisionLoc+", Time: "+flash.utils.getTimer());
rockSpawn = new rock;
[code]....
This function spawns a rock object from the library at a given location, and then moves it to the right every frame until it reaches the edge of the screen, at which point it's deleted. The problem: when a rock is spawned, it moves to the right, but when a new rock is spawned, the previous one stops dead. Each rock moves progressively faster, as if each rockSpawn.x++ is stacking to make the object move 1 pixel faster each time the function is called.
How would I modify this code to spawn separate instances of a projectile that behave the same? Also, how would I reference them for say, collision detection? That is:
Code:
if (a rockSpawn instance collides with the movieClip ship)
{
do stuff;
}
I first noticed it when this function started throwing a 1009 error:
[Code]...
were throwing the 1009 error. Which is wierd on two accounts. First, if I remember right, error 1009 comes about when referering to an object that is not on the stage. Which makes NO sence when getting it from an addChild! Second, this error only starts to occur the second time I use the function.
[Code]....
when i addChild an object to the stage the x and y placement of that object is always diff from the ones people display in tutorial. nowhere in their code or mine did i define the x or y yet.... so how is it that there placement of when they add the object onto the stage is diff then mine?
View 2 RepliesSolution: if you have the same problem, addElement() instead of addChild() is what did it
I'm trying to move away from mxml to actionsctipt. I have a <s:Rect> that I've created and set its properties, but having trouble adding it.
var aRect:Rect = new Rect();
//set properties like aRect.x, aRect.y, aRect.width, aRect.height
//tried adding it various ways
addChild(aRect);
Application.addChild(aRect);
[Code]...
I'm trying to use addChild on a movie clip but can't as Flash gives me this error:Error #2007: Parameter child must be non-nullGreat. Okay.The movie clip into which I'm trying to add a child is set to null by default. How do I unnull it? Just what am I not understanding?
View 1 RepliesI have circles in my stage that I addChild them but they are front of all my objects but I need them under one of my objects.
my Child Name: Balls
my Front Object Name: Border
I am trying to get a circle shape and a text-field sit inside a square sprite, using addChild() method. Both the children seem not to agree sitting in the lap of their parent; and are sitting at a distance, instead. If I create a square symbol on the stage and run the application, everything is fine.
[Code].....
We are supposed to build a game, and each of us is to make a level. So we did, but integrating them is giving me issues. Specifically, each of our levels are contained within a symbol. I personally have a ton of symbols that point to eachother already (main.as, menu with various elements, level one, boss level) but for whatever reason whenever I try and addChild my partner's level it gives me "TypeError: Error #1009: Cannot access a property or method of a null object reference."
the way I've been doing it looks like:
var levelTwo:SkiHill = new SkiHill();
parent.addChild (levelTwo);
parent.removeChild(this);
like I said, it's worked every time Ive used it between my own things. My partner's is a no-go. If I just slap his level on the stage and go it runs fine, and it will properly add/remove child to transition to one of my levels.
All I can think of is that I've checked all the names. I also noticed my partner didn't use an ADDED_TO_STAGE event listener, but adding that didn't help at all.
Can't figure this out for the life of me. Its probably something simple, but I can't find any solutions online. Can anyone help a brother out here? All I'm trying to do is assign text to a dynamic text box that is inside a movieclip (loaded from the library using addChild()
[Code]...
when I use:
var a = parent.addChild(cloud);
a.x=10;
a = parent.addChild(cloud);
a.x=100;
I only get one cloud made at the position (100,y) (or, the last cloud I declare is the only one to show). How do I add multiples of a movie clip ?EDIT: I tried using addChild(new cloud) but the compiler says "Call to a possibly undefined method cloud."
When I pull Illustrator elements with Outer Glow into Flash, the glow looks pretty nasty...lots of artifacts and "squares" throughout the area where the glow is.
Is there a way to preserve the high quality glow I see in Illustrator once I import those graphics into Flash?
I'm loading an xml file in AS3/Flex for an AIR app. When I save it, the indenting looks pretty, however all the tabs from the original file, are now spaces. Can I save to that the tabs remain?
open file code:
var file:File = event.target as File;
var fileStream:FileStream = new FileStream();
fileStream.open( file, FileMode.READ );
[code]....
I need to store an array of objects that will serve as a back-up of some master data. I then will need to copy that array and manipulate the object data within. The problem is: when i change any of the object data in the new array, it is changing the orginal object data in the "back-up" array - the array that should not be changed in anyway.[code]...
View 9 RepliesI would like to know if there is a way of maintain the stroke size whilst resizing my object with actionscript.I have an object that imported from Illustrator with a 7pt stroke and would like that stroke to maintain its aspect even when resized to 10%
View 1 Repliesok, i'm trying to animate an object's alpha by as...
thats what i thought was corect:
itm3.onRollOver = function() { itm3.gotoAndPlay("over");}itm3.onRollOut = function() { itm3.gotoAndPlay("out");}itm3.onPress = function() {var newsFade:Tween = new Tween (_root.newsMc,alpha,Regular.easeIn,100,1,2,true);
}
not working...
Ok I know this practically sounds elementary, but I don't understand what I'm not doing correct here. I draw a simple rounded Rect
[Code]...
In my application, I have a chart that I want to display in a TitleWindow when clicked on.
var win:TitleWindow = PopUpManager.createPopUp(this, TitleWindow, false) as TitleWindow;
win.addChild(myChart);
PopUpManager.bringToFront(win);
It does indeed place the chart in the titlewindow that shows up, but it removes the original chart from the parent. Then, when the titlewindow is closed, my chart is simply gone. I can't figure out how to clone the chart -- all the methods I've tried failed
Solution:
public var barChart:BarChart;
public function onClick(e:Object):void
{
[Code].....
I use a flash program in my website to resize pictures before transfert, for preserve my bandwidth.
But, when i try to transfer a .png file with transparency, the resize don't maintain transparency in the .png file result. It's a problem for use it after.
[Code]...
So I have so parts of actionscript which I am figuring out on how to make them one. What I am wanting to do is move an object to the right and fadeout. Here is my code to animate right 10 pixels, this works perfectly.
[Code]....