ActionScript 3.0 :: Replacing A MovieClip With A Drawing?

Oct 27, 2010

I'm creating a platforming game, and I have a fun little water thing set up. My goal is to be able to drag a water object from the library to the scene, and have the water physics kick in when the game starts.
 
To do this, I made the water object a black line, because width is necessary to know how wide I'd like the pool to be.  Within the class I have a heightmap, so then I can connect all the heights together with lines using the drawing API.
 
The problem is, I can't get the original black line to disappear while still displaying the new lines and points Setting the alpha to 0 will permanently make everything invisible.  I'm kind of new to this so maybe it's a dumb question.

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Drawing Over A Movieclip In A Custom Drawing App?

Jan 13, 2012

I've created a drawing tool which allows the user to draw on the canvas, the problem is that if I try to draw over a movieclip nothing happens. Is there a way I can allow for the user to draw over movieclips? For example if I had a background of paper?

Here's the code I'm using for it:

// This code is for drawing the lines on the page
//1.
var drawingLine:MovieClip = new MovieClip();
addChildAt(drawingLine,0);

[code]....

View 8 Replies

ActionScript 3.0 :: Replacing Movieclip With Another Movieclip When It's Clicked On?

Jul 9, 2009

I've got music player and one of the controls is a movieclip which acts as a PLAY and PAUSE button. What I would like is to swap the image of this movieclip everytime it's clicked. How would I go about doing this?

Here's my code...

ActionScript Code:
playPause_btn.addEventListener(MouseEvent.CLICK, onPlayPause);
function onPlayPause(event:MouseEvent):void{

[Code].....

View 1 Replies

Replacing Movieclip With Another When It's Clicked On?

Jul 9, 2009

I've got music player and one of the controls is a movieclip which acts as a PLAY and PAUSE button. What I would like is to swap the image of this movieclip everytime it's clicked. How would I go about doing this? Here's my code...

[Code]...

View 1 Replies

ActionScript 3.0 :: Replacing This.graphic For A Movieclip?

Jun 12, 2011

At the moment I am busy editing a little flash game, but i was wondering if i could replace the part below for a movieclip

ActionScript Code:
this.graphics.beginFill(0x333333);
this.graphics.drawRect(0,0,25,25);
this.graphics.endFill();

View 2 Replies

Actionscript 3 :: Replacing Bitmap In A Movieclip In Flash?

Nov 14, 2011

But now the tracks are objects in an array, that will grow larger and larger (and slow down the game over time). How can I paint them on the level bitmap? And how to reload the bitmap when you restart?Have searched for an answer for days but have not found one.I know how to combine a bitmap and add it to the stage, but not how to replace it in the movie clip object:

var newLevel:BitmapData = new BitmapData(grassLevel.width, grassLevel.height);
var newDebree:BitmapData = new BitmapData(debree.width, debree.height);
newLevel.draw(grassLevel);

[code]......

View 1 Replies

Actionscript 3.0 :: Replacing A Loaded Image In A MovieClip?

Apr 27, 2011

Hi there I am still a novice to Actionscript 3 and would like some help please. I am creating a grid style image gallery that is XML driven. What I need help with is getting my images to, at random times, swap out with another image. Each image is added inside a Movieclip and can be unloaded. What I need is to load another random image into the now empty MovieClip. Hope this is ok description.

[Code]...

View 1 Replies

ActionScript 1/2 :: Replacing A Movieclip Without Changing It's Children/depth/tweens

Feb 5, 2010

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with a new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.
mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime.

View 5 Replies

ActionScript 2.0 :: [mc] Replacing A Movieclip Without Changing It's Children / Depth / Tweens

Feb 4, 2010

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with the new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.

mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)
Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime. Or am I thinking in the wrong direction and are there other ways to restyle a movie clip?

View 1 Replies

ActionScript 2.0 :: Drawing Lines From One Movieclip To Another?

Jan 23, 2004

I am making a movie clip and want to draw lines from one movie clip to another to make it look like connectors on a flowchart. How do I use the returned values using a getbounds() method to draw a line from movie clip A to movie clip B. how the xMin, xMax, yMin and yMax values translate to finding the 4 corners of a rectangular movieclip. Can I use these values to draw lines from the movieclip using lineto().

View 11 Replies

ActionScript 2.0 :: How To Draw In Particular MovieClip Using Drawing API

Oct 7, 2005

How can I draw only in a particular mc using drawing API...

View 4 Replies

ActionScript 3.0 :: Drawing Bounding Box To A MovieClip?

Nov 6, 2011

I need to draw bounding box surrounding a movieClip with arbitrary registration point with AS3. The movieClip may be of any shape and can have it's registration point anywhere.

View 5 Replies

ActionScript 2.0 :: Drawing Lines From One Movieclip To Another

Jan 23, 2004

I am making a movie clip and want to draw lines from one movie clip to another to make it look like connectors on a flowchart. How do I use the returned values using a getbounds() method to draw a line from movie clip A to movie clip B. Can some one show an illustration explaining how the xMin, xMax, yMin and yMax values translate to finding the 4 corners of a rectangular movieclip. Can I use these values to draw lines from the movieclip using lineto(). If so how do I do that?

View 11 Replies

Actionscript 3 :: Foreach Drawing Object In Movieclip?

May 26, 2010

I got a europe map designed in flash (1 movieclip, 1 frame, really simple), which contains the map as drawing objects directly inside the scene and in addition some specific countries as clickable buttons. So far it's working fine. What I need now is to make all the other drawing objects clickable without having to edit and script each object. I'm thinking about something like this (pseudo code):

foreach(obj in MovieClip) {
if(obj !typeof(Button)) {
obj.addEventListener(MouseEvent.MOUSE_DOWN, genericClickListener);
}
}

I just don't know the syntax how to achieve that.

View 1 Replies

Flash - Drawing Sprites Between Layers On MovieClip

Aug 10, 2011

Is it possible to draw a sprite, on a movieclip, on a specific layer? I have a MC I created in the Flash designer, and it has 3 layers on it, background, some layout stuff, and then some text. In actionscript i've created a Sprite object in code, drawn a rectangle on it, and added it to the stage with addChild (called from within the MC). The problem is, the sprite is always being drawn above all the layout stuff I added in the designer. Is there any way to add the sprite to the MC at a specific layer? In this case the background layer. I tried changing the z on the sprite and no effect.

View 3 Replies

ActionScript 3.0 :: Drawing A MovieClip To A Bitmap As Though It Was The Screen?

Jun 23, 2009

Basically, I have a BitmapData object which is acting as a virtual screen.

I have a MovieClip which I want to render to the bitmap using the same transformation as though the bitmap were the screen. However, the MovieClip is not attached directly to the root

The BitmapData.draw() method takes a Matrix as an optional parameter, which I think I need to set as the MovieClip's localToGlobal transformation matrix. However, I don't know how to obtain or construct this!

View 2 Replies

ActionScript 2.0 :: Drawing Line Behind Cursor Movieclip

Feb 21, 2012

I'm working on a Flash project in which the user can choose to draw on the stage. To indicate to the user that it's possible to draw, I'm changing the default cursor to a pen image. I'm doing this by attaching a movieclip to the cursor, then hiding the cursor:

ActionScript Code:
on (press) {
penOn = true;

[Code].....

All this works great, with one problem. The line users draw appears on top of the custom cursor, so if they go back over something they've already drawn, they can't see the cursor anymore. I've tried a bunch of fixes, but nothing has worked. FYI, that first block of code I pasted is attached to the button that turns the pen on, while the second block of code is in the bottommost layer of the movie.

View 3 Replies

ActionScript 3.0 :: MovieClip Sprite Versus Drawing With Graphics

Jan 26, 2012

I have a program that dynamically draws a polygon wherever the user clicks on the screen. (using lineto, moveto) However this polygon is always behind the other symbol objects on the screen even though its added last in the childlist. Is there an issue with depth when drawing symbols vs. drawing with lines? How can I ensure my dynamic object will display in front?

View 3 Replies

Flash :: Scaling Drawing Objects Inside Movieclip?

Apr 12, 2011

So I've got problem with some drawing objects inside movieclip in my flash file... Setting width and height of flash to match browser's w&h got my movie clip to get correct values, but unfortunately drawing objects inside of it are not scaled as movieclip. Those object are just random stripes that got some tween on it acting as somekind of preloader... All graphics are pulled from ai file, so no AS was used to manipulate them, just pure tweening in design mode...So if my stage w & h are lets say 720 x 50, graphics inside movieclip are 1600 x 900 which match my monitor's resolution.

View 1 Replies

ActionScript 3.0 :: Instead Of Drawing Circles By Code / Want To Call Movieclip

Jul 7, 2009

Can someone tell me how to command it to retrieve a movie clip in my library instead of drawing stuff by code and working with that? The movie clip I want to get is called "float1".[code]

View 9 Replies

ActionScript 3.0 :: How To Tween Drawing Line (MovieClip Graphics)

Jan 20, 2010

How can I Tween drawing a line mc.graphics.lineTo(); ? I just see tweener has an onUpdate property awesome.

View 0 Replies

ActionScript 3.0 :: Drawing A Boundary And Testing It Against Only A Part Of A Movieclip?

Nov 23, 2010

I have a map of isometric buildings that the player walks around. in the image I have 1 and 3 working fine. I find the corner points of the building and test it against the players location and sort out their depths. easy.but 2 and 4 are the trouble makers. the left and right side of the building.because its isometric there is that diagonal line making up the sides.my only idea so far is to draw a line box around the building at test collisions against the "feet" of the player. but to do that I must draw a box and make it invisible but still be testable against only the bottom portion of the player, the players feet.

View 5 Replies

ActionScript 2.0 :: Can't Stop Movieclip / Call Drawing Api Functions?

Jul 5, 2004

I made a movieclip with 5 frames inside. Well, outside, when i push a button stop, runs the code: this.movieclip_name.stop(); , but, doesn't stop.Inside these frames there is a enterframe function that call drawing api functions.

View 1 Replies

ActionScript 1/2 :: MovieClip Control - Drawing Line By Connecting Dots

Oct 7, 2009

I've almost got a bit of flash finished, The .swf so-far is here: [URL]. For some reason the file won't attach but the important bit of code I have so-far is below. I need to make a line to literally 'connect the dots', each of which is one end of a movieclip, I know it needs to boil down to ' line x,y, to (movieclipname)x,y, but cannot work it out!

time.onChanged = function() {
if(time.text.length == 4) {
var hours:Number = parseInt(time.text.substr(0,2),10);
hours *= 60;
var minutes:Number = parseInt(time.text.substr(2,2),10);
[Code] ......

View 3 Replies

ActionScript 3.0 :: Line Drawing Script On Stage Doesn't Work In MovieClip?

Jul 28, 2011

I have a little snippet of code that allows the user to create a line with the mouse, and clears the line if they end up touching the hitbox with the mouse, while they're drawing the line. It works fine when it's just thrown onto the main timeline. However, when I try to encapsulate it within a movie clip, it suddenly doesn't work. At all. Are there any suggestions as to why this is happening? Here's the code.

[Code]....

View 13 Replies

ActionScript 3.0 :: Pencil Tool - Drawing Above A Image But The Drawing Is Below The Picture

Nov 9, 2010

i've tried to simulate a pencil tool, for drawing above a imagem, but the drawing is below the picture. How fix it?

[Code]....

View 3 Replies

ActionScript 3.0 :: Generate Drawing API Data From Drawing Object?

Jul 22, 2009

Basically I've got a reasonably complex drawing object in a fla and I want to reproduce it in a class definition using the drawing api. However obviously this is a tedious task, so is there some trick or automated method of doing this?

Last time I needed to do this it was a drawing of an arrow and I ended up writing down x,y,width,height values for everything but this one has curves in it which I don't have experience with drawing anyway.

View 2 Replies

ActionScript 2.0 :: Enabling Drawing Only When Drawing = True

Sep 28, 2009

I cannot get this to work. Without the "var drawing", "var drawing being true or false" and the "if statement", it works fine. But I need to add the "var drawing" so that you can only draw if you turn it on by pressing the "draw_btn" button. Note, I do not get an error, the script "apparently" contains no errors. Here is the code:

ActionScript Code:
var drawing = false
_root.createEmptyMovieClip("myLine", 0);

[Code].....

View 3 Replies

ActionScript 3.0 :: Drawing Api Drawing 40,000 Objects

Feb 18, 2009

I need to draw on stage about 40,000 4x4 squares each a different color. The color is determined by an xml file. I have this working in as2 and have converted it to as3 the problem is the amount of time it takes to draw is causing cs4 to time out. I have extended the script time out to 60 seconds. In cs3 as2 it would draw the squares in about 15 seconds. I was hoping as3 cs4 would improve performance but seems to be the opposite. I have tried several methods such as adding children and various drawing variations. the bellow seems to work the best, but is still causing flash to crash.

ActionScript Code:
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Shape;

[Code]...

View 9 Replies

ActionScript 3.0 :: Replacing Mouse With Mc

Nov 20, 2009

When I use the code in red once my cursor has replaced the mouse i can no longer click on my boxes. When i do not use the hide mouse code i can click the boxes just fine. What am I doing wrong? [code]

View 1 Replies







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