ActionScript 2.0 :: Setting Bounds For MovieClip On Stage In Flash?

Jun 9, 2006

I have a "circle_mc" movie clip and its registratoin is in the center but it moves and works fine but i dont want it to go off the stage half way I want it to stop before it goes off

ActionScript Code:
circle_mc.onRollOver = function() {
this.dx = Math.round(Math.random()*Stage.width);
this.dy = Math.round(Math.random()*Stage.height);
this.onEnterFrame = moveIt;
}; function moveIt() {
this._x += (this.dx-this._x)/10;
this._y += (this.dy-this._y)/10;
if (Math.round(this._x) == this.dx) {
this._x = this.dx;
}}

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Flash StartDrag Setting Negative Bounds?

Dec 17, 2010

I have a large movieclip (2336 x 1752) and a stage of 800 x 600. I want to be able to drag the movieclip around the stage so no white is visible:

minimum x before I get whitespace: -1536
minimum y before I get whitespace: -1152
maximum x before I get whitespace: 0
maximum y before I get whitespace: 0

I have tried this:

Code:
var mcBounds = new Rectangle(-1536, -1152, 0, 0);
mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

[code]...

But it doesn't drag at all...when I try it just moves it to it's maximum position and stays there.Is it because the rectangle can't have negative values?

View 2 Replies

Flex :: Setting Bounds For WindowedApplication

Jul 9, 2010

for some reason this flex 4 code gives me an error but I can't figure out why. In my WindowedApplication I have:[code]That seems like a bogus error since I can assign pref.bounds to rect without an error. I don't know why this isn't working. It works under flex 3 compatibility mode but that also breaks a lot of my spark components so I can't use it.

View 1 Replies

Actionscript 3 :: Display Objects Outside Of Stage Bounds Still Get Rendered By Flash?

May 7, 2010

If an object exists outside of Flash's stage boundaries, is on the Display List, and is visible, is it causing a performance hit from Flash rendering it? In other words, does Flash render what isn't seen?

This leads me to believe so:
http://stackoverflow.com/questions/170203/how-do-you-make-flash-not-render-an-object-on-the-stage

View 1 Replies

ActionScript :: Flash - Continuously Dragging Objects Within Bounds From Off-Stage Mouse Coordinates?

Jul 2, 2010

is it possible for flash to detect off-stage mouse coordinates in order to continuously drag an object within its bounds while the mouse is moving outside of the stage? for example: i have a draggable red square on my stage. the stage is the bounds of the drag. if i drag the red square to the bottom of the stage and continue to drag outside of and around the stage, i'd like the red square to continue moving within it's bounds, following the mouse coordinates. currently, dragging halts as soon as i leave the stage and the red square only begins to move with the mouse coordinates if i reenter the stage bounds.

View 2 Replies

ActionScript 2.0 :: Tell If Something Is Within The Stage Bounds?

Jun 23, 2009

I have a bunch of images going on all at once, some on the stage, and some off, and i would like to find a way of telling whether or not they are currently on the stage or not....

I know i can do the whole

checkStage = function () {
if ((mc._x>=0) && (mc._x<=Stage.width) && (mc._y >= 0)&&(mc._y >=Stage.height)) {
//have mc do whatever here

[Code].....

that way i can satisfy my laziness AND achieve what i'm trying to do without having to deal with long winded paths and a bunch of else if's

View 1 Replies

Actionscript 3.0 :: Get Bounds Of A Rectangle On Stage

Apr 30, 2009

I have a simple MC on the stage. I want to create a simple conditional statement that would check if the mouse is on the rectangle using get bounds. something like [code]Basicaly...how do I properly use the getBounds in a situation like this?

View 3 Replies

ActionScript 3.0 :: Cropping Externally Loaded SWF To Stage Bounds?

Jul 27, 2009

When using the Loader class to load an external SWF into another timeline and then displaying that SWF using addChild on the loader.content, one discovers to one's consternation that elements positioned off the stage of the external SWF are still displayed.To illustrate this with an example: suppose you have a 500x500 pixel "main" SWF, and it loads an external SWF at runtime and positions it in the center of the stage. And suppose that this external SWF's document properties set the stage width to 200 x 200 pixels. However, when authoring this external SWF, we draw a box that's 300 x 300 pixels, so part of this box is actually off-stage.

When you play the external SWF in the standalone Flash player, it is sized correctly at 200 x 200 pixels, and the rest of this box is cropped off.When you load this external SWF into the "main" SWF and use addChild() to put it on the stage, you will see the full 300 x 300 pixel boNow of course, we can simply solve the issue using a mask, but I'm wondering whether there's a more elegant solution that's built in, either to the MovieClip or the Loader or the LoaderInfo classes. Something that says "respect the document bounds of the original SWF" or "crop to stage dimensions".

View 1 Replies

ActionScript 2.0 :: Floating/Moving Movieclip Within Bounds Of Current Location

Nov 8, 2010

I've creating a site that has a long horizontal line of fullscreen background images. Currently, moving the mouse left and right scrolls the images right and left.

I also have left and right arrows also for cycling through the images. I have several arrays with various bits of data about the images to help with the cycling. 1 array contains all the widths of the images Another contains all the x positions of the containerClips within image_mc.

The images are in a mc like so
mcholder.image_mc.containerClip0
mcholder.image_mc.containerClip2
mcholder.image_mc.containerClip3
....

mcholder is on the root.

What I would like to do, is instead of continuous scrolling left and right, I only want the user to be able to scroll about 20-30px past each image, (I'm guessing based on the current image_mc._x

When a user clicks an image it tweens into place and onComplete function stores the current image_mc._x value in a currentImageX var.

I'm not sure how to this to limit my left and right scrolling when not clicking.

My current scrolling code is this.

[Coe]......

View 3 Replies

ActionScript 3.0 :: Draw A Bitmap With My Movieclip Content Gets Wrong Bounds?

Jan 21, 2010

I'm trying to export my movie clip into an image, everything works fine but when the user draws in negative coordinates, the draw bitmap command doesn't get my movieclip as I need, here's a graphic explanation of what's going on:As you can see the user can draw in any part of my movie clip (black border), the 0,0 coordinates are in this example located in the black spot. when I get the bounds of my object I get correct values (in this case i get negative x and y and the correct width and height), but when I apply the draw bitmap command what its captured is the area represented with the red border, the height and width values are correct but it captures from the 0,0 coordinates and not from the coordinates I want! anyone? i have a dead line approaching.this is the code:

ActionScript Code:
//funciones click
function exp_cli(e:MouseEvent):void {

[code].....

View 4 Replies

Flash 10 :: Manually Setting Rotation On Stage Objects?

Mar 18, 2012

Hi everyone. This should be a simple question. Using flash professional CS5

I'm manually setting up stuff on the stage (authortime). And i've placed an object at a specific rotation. I now want to place another object, with the exact same rotation.

The problem is, i cannot find any way to read the object's rotation, or to specifically set it (ie: by typing in a value, rather than by manipulating editor handles)

I'm looking in the properties window and there's readouts/settings for position, size, scale, a ton of 3D properties, color effect properties, display properties, and filters. But there's no field for rotation. why the hell not! Isn't that a ridiculously simple and stupid omission?

so far the best method i can find is using free transform, and adjusting it manually til it "looks right", which is a very un-exact way of doing things.

View 1 Replies

ActionScript 2.0 :: Mouse Scroll The Entire Map Mc Inside The Bounds Of The 500px X 500px Stage

Aug 14, 2007

I have my stage set at 500px x 500px. I have a map mc on stage that is 2500px x 2500px and I am trying to mouse scroll the entire map mc inside the bounds of the 500px x 500px stage. The map mc xy ref coordinate is in the center of the graphic. This is a math problem for me. An example would be [URL]

View 1 Replies

ActionScript 3.0 :: Get "on Stage" Bounds Rectangle Of Xyz Rotated Sprite

Dec 28, 2011

i cant get "on stage" bounds of sprite that rotated in 3d space

Code:
var draggableContent:Sprite=new Sprite();
var _3dContent:Sprite=new Sprite();
var _child3D:Sprite=new Sprite();

[Code]....

View 0 Replies

AS3 :: Flash - Setting Dynamic TextField.text From A Parent MovieClip?

Mar 4, 2010

I have a MovieClip that has a Dynamic TextField: let's call the instance of the field txtName. I want to set the text field on the fly for txtName, so I add a little ActionScript (3!) that does it nice and easily: txtName.text = "Foo";reat. Now why isn't it working when I try the same thing from a parent MovieClip which contains the MovieClip that has the dynamic text? Example:Child MovieClip with TextField ActionScript 3 in Frame #1:

//------
function SetText(str:String):void {
txtName.text = str;

[code].....

View 2 Replies

ActionScript 2.0 :: Flash 8 - Setting X Property Of Dynamically Created MovieClip

Feb 28, 2007

Long time listener, first time caller here. I'm having trouble with how Flash sets the _x property of a dynamically created movieclip. If I create a rectangle on the stage using the Drawing API:

Code:
//for the purposes of this example, assign a value to i
var i:Number = 0;
//assign var squareName
var squareName:String = "square" + i;
//create an empty movieclip named [squareName] at depth 1
this.createEmptyMovieClip([squareName], 1);
[Code] .....

I'm not new to Flash by any stretch of the imagination, but I have never come up against this problem before. For context, I'm actually getting my feet wet with the Tween class, and am having trouble animating dynamically created movieclips due to this confusion with coordinates. When I tween a dynamically created clip from one set of coordinates to another, they are offset by the movieclip's _x and _y properties starting at 0, 0, rather than their actual position on stage.

View 3 Replies

ActionScript 3.0 :: Flash Setting Multiple Movieclip Properties Via A For Loop?

Dec 2, 2010

I have 35 movieclips, named s1, s2, s3 etc, depending on the value of currentDisplay, I would like to set a movieclip visible property to true while the others are set to false, I have tried the following:

Code:
for (i=1; i<36; i++){
trace(i);[code]....

but I receive an error message: 1083: Syntax error: dot is unexpected. I assume it is referring to the dot before visible.

View 1 Replies

Flash :: Access Dynamically Loaded Movieclip (stage > Scrollpane > Myloader > Movieclip)?

Oct 16, 2011

what I'm trying to do is accessingsnapText = scrollPane.source.textSnapshot;from an external swf. I've tried:

trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000));
trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000));
trace("-->: "+mc.textSnapshot.getText(0, 1000));

[code].....

View 3 Replies

ActionScript 3.0 :: Flash Targeting Movieclip On Stage From Inside A Movieclip

May 18, 2010

On the stage I have a movieclip called mc_back. I also have a movieclip on the stage called mc_content. Now, inside mc_content I have a bunch of code and some of it adds, or should add, an EventListener to mc_back as well as a a function that works when mc_back is pressed.

So basically, all code is written inside mc_content and some of it needs to interact with mc_back.

how to target mc_back from inside mc_content. Using stage.mc_back or root.mc_back doesn't work and Google should be my friend, but in this particular problem, it's acting more like my enemy.

View 8 Replies

Flash 10 :: Out Of Bounds Expandable Banner?

Dec 30, 2010

How is this kind of expandable banner done? [URL]

View 0 Replies

ActionScript 3.0 :: Setting X And Y Properties According To Stage?

Jan 18, 2011

I need to assign a symbol that is added dynamically in a symbol, x and y coordinates (that are from the main timeline).

View 2 Replies

ActionScript 3.0 :: Stage Align Setting The Min And Max

Nov 6, 2011

if i have some mc objects on stage and they align lets say to the top side and bottom of the screen then if resized smaller than stageWidth 800 and stageHeight 550 they stay where there are and if the stage is resized bigger then they lock to the top side and bottom. Ive got so far with it and it works ok but if i try and resize the window randomly with the mouse ( like clicking the bottom right hand corner and squiggle the mouse around it acts weirdly.

View 3 Replies

Actionscript 3 :: Flash Supplied Index Is Out Of Bounds?

Dec 1, 2011

I'm trying to remove children from a movie clip upon user interaction but it's saying "the supplied index is out of bounds" - however, I must be missing something because it doesn't seem like anything is out of bounds. This is my code:

Circle.as:
for (var i=0; i<3;i++){ //this number should be based on the number of children found in the XML

[code].....

View 2 Replies

ActionScript 3.0 :: Setting Alpha On Clip Already On Stage

Jan 7, 2011

If I have a clip already on the stage. how can I go about having code to set the alpha = 0 so that the clip is default invisible. If I set the alpha in the class constructor it gets reset to what its set on the stage. I tried to use the Event.ADDED event since that gets dispatched before rendering too (I think). I mean If I don't have any choice then I'll just set it to 0 manually . Just was hoping to have the capability to set it in code. So that I can still see the clips on the stage just to make it easy for moving them around if I needed to. Where I need to set the alpha so that it takes effect 'after' the default values get applied..

View 9 Replies

ActionScript 2.0 :: Setting The Stage Size From A XML File?

Aug 1, 2008

is it possible to set the stage (the actual flash movie as it appears on the screen to the user) size in as2.0? i have a photo gallery that i plan on reusing on several sites and i need it to be different sizes on each site and i'd rather standardize it so that i never have to open the .fla file, just open the XML file that it pulls all of the images from and have an attribute for the stage size. my xml file is as follows where movie_width and movie_height would be the dimensions of the flash file as it appears on the site.

[Code]....

View 1 Replies

ActionScript 2.0 :: DataGrid Component - Setting Stage Width?

Feb 29, 2008

How to get my data grid working so that it is set the stage.width - 250; therefore it would scale with the window when minimized.

View 3 Replies

Flash :: Gradient Fill Disappears When Drawn Outside Bounds Of Parent?

Nov 19, 2010

I'm trying to draw a gradient in Flash using beginGradientFill and drawRect, but when the rect being drawn is partially outside the bounds of the parent, the gradient isn't drawn at all.

For example, consider the code below:
function testGradient():void {
var g:Graphics = container.graphics;
var width:Number = container.width;
var height:Number = container.height;
[Code] .....

When the rectangle being drawn lies within the bounds of container, everything works: However, if the rectangle lies outside of the bounds of the container, the gradient isn't drawn at all. For example, if the code is changed to:
...
var x:Number = 10;
var y:Number = 10;
...
Then the gradient disappears: Short of doing the math required to draw the box inside the bounds of the parent (and fixing up the gradient so it looks correct), is there any way to deal with this?

View 1 Replies

ActionScript 2.0 :: Extending Outside Flash Movie Bounds In HTML Page

Dec 16, 2006

I have a flash file, which's dimensions are 500 px by 500 px. That's how I want it. However, sometimes something happens in the flash movie, causing a movieclip to extend outside the dimensions (which I need it to be seen by the user). Im putting this swf into an html file. I definately know there is a way where those out-of-bound movieclips can appear (inside a browser), overlapping other html elements, but I forgot how. Well, setting the wmode parameter to transparent will cause the movie to become transparent, revealing whatever's underneath, but this doesn't solve my problem. I don't want my movieclips to look "cut" when they happen to pass across my bounds. Probably the DIV tag is related here. I know that the cheapest way to solve this is by setting the movie dimension to something like 999 by 999. But I dont want to do that!

View 3 Replies

ActionScript 3.0 :: Setting External SWF Dimensions To Root Stage Size?

May 15, 2009

I am loading the SWF just fine, but I want the SWF to fit the root stage exactly. What happens instead is that the external SWF seems to include white space from around itself.

For example, the author-set width of the Tanks game (an example file I was using) is 550px, but when I set the width of loadEvent.currentTarget.content.width to 550px, the game is resized to maybe 350px width. I have to set the value of loadEvent.currentTarget.content.width to something like 640 in order to get the game itself to make full use of those 550 pixels.

Code:
package {
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;

[Code].....

I have CS4 with AS3. I hard-coded values for cWidth and cHeight instead of getting them from flashvars because I am just testing in the IDE right now. Normally I would get those vars from flashvars.

View 1 Replies

ActionScript 3.0 :: Flash RangeError: Error #2006: The Supplied Index Is Out Of Bounds?

Apr 12, 2011

I've been adding and removing objects from my stage. Just when I think one part is fixed, another breaks. Basically, I'm getting the following error -

RangeError: Error #2006: The supplied index is out of bounds.
at flash.display:isplayObjectContainer/setChildIndex()
at flash.display::Stage/setChildIndex()

[code]......

View 1 Replies

Flash :: Rotate BitmapData When Using Draw Method. Width Height Bounds Clipping / Cropping?

Jan 29, 2010

I wrote a collision detection class that works off using BitmapData.hitTest. Basically, every update, the .draw method is called and then two BitmapData's are hitTest'ed against each other to see if there is a collision.It works pretty well, however if I start rotating the source MovieClip I use for the BitmapData, the transformations don't get registered in the draw method. So what I did was pass through a Matrix in the draw method. That works. But here's the actual issue. If I output the BitmapData to a Bitmap on the stage, I see that Bitmap is, in fact, rotating, but now it's exceeding the bounds (width and height) of the BitmapData. Which is cropping / clipping the image of the source MovieClip.

UPDATE: Basically, when the Bitmap clone of the MovieClip rotates outside the positive co-ordinate space, it doesn't get drawn. It rotates outside the bounds of the BitmapData set width and height. I can multiply the bounds by 2, and then center the bitmap inside the set bounds, but then the origin point is never fixed and the object is always being moved around. Works pretty well, but makes aligning the object to any specific point impossible.Here's my isolated test code. It requires you to have a MovieClip on the stage named "iTest". I used a fairly vertical arrow shape (higher than it is wide) so I could keep track of rotations visually accentuate the clipping problem:

var rotateTimer:Timer = new Timer(10);
function rotateObject_init():void
{

[code].....

View 2 Replies







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