ActionScript 3.0 :: Manipulating Multiple Shapes On The Stage?
Dec 3, 2010
I want to add multiple rectangles to the stage and manipulate them on an individual basis. Here is my code:
<code>
var rectangle:Shape = new Shape;
rectangle.name = "firstrectangle";
rectangle.graphics.beginFill(0xFF0000);
[Code].....
I get an error back that says firstrectangle and secondrectangle are undefined.
View 4 Replies
Similar Posts:
Mar 24, 2010
Here is the problem I have: after I change the index of one movieclip using this code
oldIndex=getChildIndex(DisplayObject(e.target));
setChildIndex(DisplayObject(e.target), numChildren - 1);
when I give the object its old index
setChildIndex(DisplayObject(e.target), oldIndex);
and go to another frame of the movie, this element I have changed the index of stays on top of all elements on the new frame. My question is am I doing something wrong and if not, what can I do so that this element stays only in the frame it is placed.
View 1 Replies
Sep 16, 2011
Currently one of our teams suffers from a very strange phenomena: after manipulating the z property of a MovieClip and changing the stage quality some event listeners of nested MovieClips seem to disappear (or at least not react to the proper events any longer).
The problem also only appears when doing both, changing the stage quality and manipulating the zproperty.
Here is a simple class demonstrating the issue:
package {
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.display.Graphics;
[code]....
View 4 Replies
Apr 2, 2009
I am trying to slice or break a movieclip into multiple random shapes.or MCs. I am playing around with BitmapData and pixels but no luck so far.
View 5 Replies
Mar 5, 2010
I have been practicing on how to draw shapes on the stage with actionscript and it seems fun.
Code:
var rec:Sprite = new Sprite();
with (rec.graphics) {
beginFill(0xff23564,1);
[code]....
But now I was wondering how hard would it be to animate what you draw for instance how would you animate a simple line?
Code:
var rec:Sprite = new Sprite();
with (rec.graphics) {
lineStyle(0);
[code]....
View 5 Replies
Feb 2, 2012
I had something wrong in Flash Pro CS5, all vector shapes and text fields are too sharp and output is very good and smooth ( Normal ) !
View 5 Replies
Feb 18, 2012
I am copying a bunch of shapes from my stage to a set of bitmaps for filtering.
Is there a faster way to do this? Is there a way to copy everything over together from the stage rather than how I'm doing it by copying the shapes in my array one by one?[code]...
View 1 Replies
Feb 17, 2009
I have a question about shapes (i mean the flash.display.Shape class). Is it possible to import Shapes directly from the library as Shapes and not as Sprites/MovieClips? Shapes are supposed to be faster than MovieClips/Sprites, right? So why is it only possible to import MCs/Sprites from the library? I understand that generally shapes could be created solely by actionscript, but in my case the shape comprises of many points and is curved - so it's quite infeasible.
Is there maybe some sort of plugin to generate code that would draw the desired shape from a drawn shape in CS4? And a last one: Are there any benchmarks out there for performance comparison between sprites/mcs/shapes? How much performance do i loose by using a sprite instead of a shape?
View 2 Replies
Mar 31, 2012
i want to be able to create multiple shapes and store them perhaps in an array to be able to dynamically move them and change them.is there a way to have a shape object and store it an array?so that i can do something like shapeArray[0].x =100 current code
for(var i=0; i<10; i++){
var sprite:Sprite=new Sprite();
sprite.graphics.lineStyle(1)
[code]...
View 1 Replies
Sep 21, 2010
I have a problem when making flash applications with more than one frame that has symbols placed on it in that I can't declare all of the event listeners for the objects at the same time and I have found that even if I put them all on the first frame, add the event listeners, then click through to the next frame then the buttons won't work on that frame.
Does anyone have any idea how I could solve this? I did consider myself a fairly competent AS3 programmer until I realised I had no idea how to handle this sort of thing. Solved: I initialised the clips from my external class and then addChild'd and removeChild'd them as I needed to and placed their x and y on addChilding.
View 2 Replies
Oct 18, 2011
I created a custom textfield component that I need multiples of in a single swf. I also created a non-visual wrapper component to manage them. I am sending info from the textfields to wrapper. I was planning on using the child index to associate the info with the right component. The problem occurs when I have two instances of the textfield component and one of the wrapper on stage and I use stage.numChildren and it returns 1.
View 1 Replies
Feb 7, 2010
So I have a simple as3 project i'm creating in FlashDevlop and I was hoping to create the layout as a simple swf thats loaded in then move the assets where they need to go. Things like roll over states would be stored on different frames to make it nice and easy for designers so they don't have to know flash. And loading it is no problem but how do you target the movie clips inside it or how do you even attach it to the root? When I say target I mean as in how would I target it to change say the height or width. I know this is broad question so even pointers to a good FAQ or example project would be helpful. I spent a little time on google but all im finding is how to load a SWF not how to deal with it afterwards.
View 1 Replies
Aug 31, 2004
How do you address a mc attached to another mc?I have an array of movie clips some of which I have attached additional movie clips to. Now I need to alter scale/alpha etc of those additional movie clips.[code]How do I now manipulate the "ExtraMC" movie clips? I know I can use parent to get at the parent mc but how do I get at the "child" when names are dynamically created as above?
View 2 Replies
Mar 26, 2009
I have a menu with 5 menu items that when an item is selected, the non-selected items need to be moved. All are movie clips. When user selects item 1, the remaining items will slide underneath item 1. I want to make a custom function so as to alleviate unnecessary code. I am moving the MC's with tween class.
View 1 Replies
Aug 31, 2004
How do you address a mc attached to another mc?
I have an array of movie clips some of which I have attached additional movie clips to. Now I need to alter scale/alpha etc of those additional movie clips.
ie.
for (i=0;i<BasicMCArray.length;i++) {
_root.BasicMCArray[i].attachMovie("myExtraMc","ExtraMC" + i,depth++);
}
How do I now manipulate the "ExtraMC" movie clips? I know I can use _parent to get at the parent mc but how do I get at the "child" when names are dynamically created as above?
View 2 Replies
May 5, 2009
i have a photography website, the main 'index.swf' file has two scenes, one for the loader and one with the content.i have a navigation menu:item 1, item 2, item 3, and so on. i have 10 layers, my nav menu is on layer 10, at the very top.i also have a a layer for each one of my navigation menu content. Now i click on item 2, and i load a external movie clip called "fotos_mc" on to the stage and inside this movie clipe i load pic1.swf using: loadMovie ("pic1. swf", 1);it loads fine, except that it loads on top of my navigation menu, logo and so on, even it's on a layer that's under the layer where i have placed my menu and logo. is there a way that i have load my movie so that it displays behind my menue?
View 3 Replies
Oct 2, 2009
Okay, so I am filling a TileList component with custom "ChordUnit" MovieClip objects, each of which is associate to a ChordUnit ClassI've established a way of determining if any of these objects are being moused over or clicked:
public function setChordBinSong(song:int, extend:Boolean):void {
dpChords = new DataProvider();
for (var i=0; i < activeChords.length; i++) {
[code].....
View 10 Replies
Jan 22, 2009
I want to dynamicly add images from XML to movieClips and then add event listeners to these movieClips. What is the best solution? XMl loads correctly, it also add 2 movieclips on stage, but it throws errors when I try to add event listeners to movieClips. How could I do that? I want to go to different frames on release of some movieClips. How can I please recognise each movieClip and manipulate with that movieClip ? (resizing,...)
[Code]....
View 1 Replies
Jan 19, 2011
I have a rather unusual problem. I've got an Array consisting of ten different MovieClips (all pre-placed on the stage), and would like to be able to manually use the gotoAndStop and gotoandPlay commands on these via the array. I've tried ActionScript Code: //This script does not work IconArray[1].gotoAndStop(1); however it simply throws out an error. Is such precise manipulation of MovieClip arrays even possible, and if so, how would I code it? (Nb: I've looked at the ForEach method, but couldn't find a way to make it sit my current dilema).
View 4 Replies
May 5, 2009
I am working with a site that's similar to : [URL]. When you click on Wedding Site and then go to the gallery, you will see the pics loading full screen and the navigation bar on top of the pics. What I have done is I have made each one of this pics a separate .swf file so
they load individually once they are called using the " loadMovie("pic1.swf") code line. On layer 10 (being at the very top) I have my menu so it will always display on top
of anything else. Now on layer 3, frame x I have a movieclip called : fotos_mc,
inside this fotos_mc on layer 1, frame 1 I call the swf using the code above:
"loadMovie(pic1,swf");
However when the picture loads, it covers the full screen on top of my navigation menu, on top of my logo etc. Which I dont understand why if the layer where I have placed my fotos_mc is under layer 10 which contains my menu and my logo.
View 4 Replies
Oct 28, 2005
I have a list of external movies. I want to import them only once and then use them as many times as I want. I need to attach them to other clips the same way I would attach them if they were in my current library with linkage option on.suppose i have a movie called s1.swf in the same location with my movie. then I have this code:
Code:
function createObj(objname, whichMc, level) {
_root.createEmptyMovieClip(objname, level);
_root[objname].createEmptyMovieClip("mc", 1);
[code]...
I don't know why the event handler for the movie "mc" is not invoked ... I have no trace record in the outpus window.
View 1 Replies
Feb 12, 2009
anchor points for manipulating shape at run time?
View 2 Replies
Nov 12, 2010
I am trying to make a card game.
The main fla file loads an external swf file that is a movie clip that has the card art images (one card art on each frame)
This works good and I can view the loaded swf on the stage.
public function FinishedLoading(loadEvent:Event):void {
LoadedMovie = MovieClip(loadEvent.currentTarget.content);
addChild(LoadedMovie);
}
What I want to do in another function is to duplicate the load swf, so that I can have 52 of the same object, each with a different picture. I need to know how to create an instance of the loaded swf.
I would like to control each instance of the loaded swf by telling each one independently of each other to go to and stop at a specific frame such as 3 or 17, or 43, based on what card is needed at that time.
This code creates an error:
var NewCard:MovieClip = new LoadedMovie();
View 1 Replies
Aug 10, 2011
I have an mc with the variable called "Section" and I want to be able to change the contents of this variable from another MC. I have tried MovieClip(parent).mcInstanceName.variable = "normal"; But that doesn't work.
View 1 Replies
Feb 27, 2010
i retrieve a list of instances located in a array to manipulate them in a variable holder. Normally, the operations can be made between two instances stored in a simple variable to variable fashion and it works realy fast.I analysed two main operations: retrieving references in a array to a variable and get or set a value from the variable reference.Here are the objects used to perform the test operation:
var v4:Vector.<Person>= new Vector.<Person>();//List of Persons instance
var refHolder:Person; //Typed referencevar refHolder2:*; //Not typed reference
Test #1: looping 200 000 times and only retrieving references from the array v4.[code]........
So my conclusion with that test is that with a typed reference you spend more time assigning a reference than manipulating a value from the reference With a not typed reference, the time spent is in manipulating the reference in the variable.Which one should i use or what should i do to have better performance with manipulating references from arrays?
Here are the files i used to test this:
reference.swf //Online example
reference.zip //Source file
View 6 Replies
Jun 24, 2010
I drew up some graphic symbols in Illustrator and imported and defined them as MovieClips in the Flash library. That way I could just place them where I want to visually on the stage. As I have been solidifying the visual design, I have been implementing it in Actionscript to access the flexibility the code provides.
In order to port a symbol to actionscript I did the following:
[Code]...
View 5 Replies
Feb 27, 2012
I have a project where the user uploads a large 300dpi image, then manipulates it (drag it, rotate it, position it). And the user can reuse this 300 dpi image, basically to make something like a t-shirt pattern. Then when the user is ready, they save this t-shirt pattern, and the save format is a large 300dpi png. This saved png file is for printing. Now I figure I can have PHP take bitmap data (as binary I assume) and the php can create the png. Is it a good idea to use Flash for this? I will have to scale down the users loaded 300dpi image so they can position. Then I assume scale it back up when it comes time to save Does anyone think Flash can't handle this?
View 4 Replies
Nov 20, 2009
I've got a project that heavily utilizes the new 3d artwork tools in Flash CS4. My question is has anyone done any tests to see if Flash is quicker with raster or vector graphics? My SWF really bogs down on slower machines.
View 2 Replies
Dec 5, 2010
When I hover the mouse above the chart elements, it can show some standard hints. How can I show the tooltips without hovering?
View 1 Replies
Oct 22, 2009
I've been handed a few Flash files written in CS4, but in ActionScript 2. I know enough ActionScript to be dangerous, but I am far from a Flash developer.
At the high level, the Flash file loads an image, rotates a portion of the center of the image, and allows the user to drag the rotated piece into the proper position (solving a puzzle, basically).
This worked GREAT when the images were loading from the local server. We've changed to remote cloud hosting for the images, though, and now are experiencing issues.
The images still load (we have all of the security and cross-domain policy files in place), but any time we try to rotate the center portion of the image we get a plain gray box instead of the rotated portion of the image.
What's weirder is that the rotated image portions show up fine in the IDE Flash player. But when viewed through a web browser the static portion of the image will load, but the rotated portion will not.
View 0 Replies