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
Similar Posts:
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
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
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
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
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
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
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
Mar 3, 2009
I opened up the NY Times homepage, and they have this giant Apple addvertisement that has animations over the entire top half of the page, outside the area occupied by the swf.
View 1 Replies
Nov 10, 2011
Although I put _x = player._x etc. code in an onEnterFrame function the masking mc is moving without the player
You see...the player is held within some borders. When cornered and then hit, the mask moves according to how it would move normally, but without the player (because he is held in place by some borders)...
Also, if I don't have a problem but I'm missing a crucial piece of code,
code on masking mc
ActionScript Code:
stop();
this._x = _root.player._x;
this._y = _root.player._y;
radiance = 180 / Math.PI;
[Code]...
View 1 Replies
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
Mar 12, 2008
I have a script that produces random motion along the y axis, however, I want that motion to occur within the movie clip that is centered on the stage, or I should say within the bounds of that movie clip.
The movie clip has a height of 335 px
[Code]....
View 9 Replies
Jul 31, 2009
I am wondering if there is an easy way of monitoring whether or not an mc is within the boundaries of another mc while it is being dragged. Currently I am using different equations to determine the leftmost, rightmost, topmost and bottommost points of each mc and then when they are being dragged comparing their x,y coordinates. Is there an easier way... I ask because this seems to be quite a lot of code to get through for such a simple operation, especially when the function containing the code is being called each time the mouse moves..
View 1 Replies
Dec 30, 2010
How is this kind of expandable banner done? [URL]
View 0 Replies
Oct 8, 2011
I"m getting this error with these two bits of AS3:
ActionScript Code:
public function tmFlashPlay():void { //Play TubMates Flash
tmClip.y = 0;
galleryMask.y = 0;
[Code]....
If I'm reading it right it is saying that the index supplied for the child is out of bounds. Yet it is the index captured earler, and I add or remove no children in between these functions being called.
View 4 Replies
Nov 16, 2010
I am trying to make this an kinda interactive map in flash. I will try to explain it for better explanation. Here is an image of the output I have a jpg image(converted to movieclip) which is way larger than the stage.
[code]...
Then I have a mask in the center of the stage and user sees a portion of the map and is allowed to scroll to move mouse around to see areas around the focused city.
[code]...
I put this numbers in by playing around but where are these values exactly coming from. I have tried everything(every possible way) but cant figure out what are these values. I need to numbers to be dynamic so I can change the focus to different cities(for example when a user click A city A should be seen inside the mask and so on).How can I make these values dynamic instead of hard coding them.
View 4 Replies
Feb 15, 2009
So I am trying to save a screenshot using JPGEncoder while in full screen mode. The document size is 100x700, and the stage is aligned to bottom. I've been able to capture the right size, however it always seems to capturing the image from the wrong start x,y position. There is some elements out of bound but I am just trying to clip them.
Here was last attempt :
Code:
stage.quality=StageQuality.HIGH;
stage.align=StageAlign.BOTTOM;
StageScaleMode.NO_SCALE;
[Code]....
View 2 Replies
Dec 15, 2010
I am creating an app that has to load a image or swf on to the stage and dynamically place and position it on either sides of the stage i.e. (top, left, bottom or right).how can I dynamically calculate the remaining bounds of the stage using the bounds of the dynamically placed loaded image/swf. ?e.g if the bounds of the loaded clip isRectangle(x=10, y=10, w=250, h=800);What is the remaining Rectangle() to use ofRectangle(0,0,1024,800); ?
e.g if the bounds of the loaded clip is
Rectangle(x=0, y=0, w=800, h=50);
What is the remaining Rectangle() to use of
[code].....
View 3 Replies
Nov 8, 2011
DisplayObject.getBounds in actionscript returns the bounds of the object with the strokes included. The left, top, width, height properties of a SymbolInstance in JSFL don't seem to include the strokes. That's the only way I've found to get the bounds of a symbol from JSFL.
View 2 Replies
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
Feb 29, 2012
I'm working with the Flash Api for Google Maps in my Actionscript/Air project. I now need the latLngBounds (the top left, top right, bottom right and bottom left) values of the current view of the map. The function map.getLatLngBounds should do that, but it always gives me a really low lat/lng bounds back. Always somewhere around:
[Code]...
View 1 Replies
Dec 3, 2009
so I tried getting this custom scrollbar to work, but the bounds must be screwed up.Whenever I click on the scroller, it shoots halfway down the screen...it then thinks that the middle of the screen is the top bound and the bottom of the screen is the lower bound
ActionScript Code:
// Scroll My Content function - AS3
function scrollMyContent () {
[code]....
View 0 Replies
Nov 15, 2010
I use this transform managerblog.ryantan.net/2010/08/free-transform-manager/I'm trying to add bounds support.But it doesn't work fine:ki44321.ho.ua/testmanager/Here is source (FlashDevelop project):ki44321.ho.ua/testmanager/source.rar
View 0 Replies
Dec 6, 2010
When I Write this code
ActionScript Code:
setChildIndex(loading_info,MovieClip(root).mcContent.numChildren+1);
I found this output
RangeError: Error #2006: The supplied index is out of bounds.
at flash.display:isplayObjectContainer/setChildIndex()
at Dan_fla::mcContent_1/on_pic_loaded()
View 3 Replies
Feb 6, 2009
It happens when you drag the scroll slider out of bounds and you release - even when mouse is up the slider still moves. I consider it a glitch. What does somebody has to do to fix it?the code I use for the slider:
Code: Select allscroll_btn.buttonMode = true;
var dragging:Boolean = false;
var bounds:Rectangle = new Rectangle(-10,-13,0,138);
[code].....
View 4 Replies
Jun 24, 2005
i have a container that is 100 x 100 and i have various symbols of different shapes and sizes (states for a U.S. map) that i am loading into that box and need to resizesome are bigger, some are smallerow to scale them proportionately larger or smaller depending on their size relative to the container.here's what i have so far
Code:
attachMovie(_root.curState, "curState", 100, {_x:25, _y:15});
widthBound = 100;
[code].....
View 3 Replies
Dec 17, 2009
I'm adding a bunch of movieclips to a container clip. I then add that to the scrollpane. When I run scrollpane.update() it gives me the error "The supplied index is out of bounds". From the full error message it looks like it's happening on the DisplayObjectContainer/getChildAt() which is run in the update() method. I thought I had it going once but now it's not again and I can't figure out what I was doing differently.
View 1 Replies
May 13, 2010
I wish to stop my mask being dragged outside the bounds of the image. The current set up I have is as follows. I created a circle and added a blur; I then exported it for action script setting its class as a sprite with the class name "Circle". I also made my image i was going to mask a Movie clip with the isntance name "mc_bee". In the actionscript I added it to the stage, positioned it and cached it. I tried to add in actioscript to create the bounds the image the mask is making with the code below:
[Code]...
View 1 Replies
Jul 26, 2009
i'm trying to addChild with an interval, using this piece of code, but I allways get an error saiyng the suplied index is out of bounds.what should I do to have mc1 added then wait lets say a second and add m2 2 and so on?
var tempo_espera:Timer = new Timer(1000, 1); tempo_espera.addEventListener("timer", inserir); tempo_espera.start(); // function inserir(evt:TimerEvent):void { for (var nv1:int = 0; nv1<promocoes.length; nv1++) {
[code]....
View 13 Replies
Mar 3, 2010
Getting a VerifyError using the TweenMax lib when calling TweenMax.to. This error doesn't seem to be specific to TweenMax (we've found other people having errors with unrelated code). Perhaps someone has some insight into what this error means and what could be causing it.[code]
View 1 Replies