Actionscript 3 :: Force A Sprite To Position Children In Reference To 0,0?

Sep 26, 2010

I'm trying to add some scroll bars to a Sprite using ScrollRect. The Sprite starts empty and when I add something at 500, 500, it should scroll, as it is outside the viewport. Unfortunately, adding a 10x10 Sprite at 500, 500, doesn't make my Sprite change its size to 510, 510, but to 10, 10 ::- (.

We all know that DisplayObjectContainers resize according to what's put in them. But I didn't know up until today that if you put something at 500, 500, the Sprite / DObjContainer will NOT resize from 0, 0 to 500, 500, but simply jump directly at 500, 500. Annoying, as I cannot put Scrollbars on something whose content fluctuates so. I need 0, 0 to remain 0, 0 and if something is placed at 500, 500, the sprite's height should increase with 500 + that something's height.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Force A Sprite To Position Children In Reference To 0,0?

Sep 26, 2010

I'm trying to add some scroll bars to a Sprite using ScrollRect. The Sprite starts empty and when I add something at 500, 500, it should scroll, as it is outside the viewport. Unfortunately, adding a 10x10 Sprite at 500, 500, doesn't make my Sprite change its size to 510, 510, but to 10, 10 ::- (.

We all know that DisplayObjectContainers resize according to what's put in them. But I didn't know up until today that if you put something at 500, 500, the Sprite / DObjContainer will NOT resize from 0, 0 to 500, 500, but simply jump directly at 500, 500. Annoying, as I cannot put Scrollbars on something whose content fluctuates so. I need 0, 0 to remain 0, 0 and if something is placed at 500, 500, the sprite's height should increase with 500 + that something's height.

View 9 Replies

Flex :: Force Containers To Do Layout After Children Rotated?

Aug 6, 2009

My problem is pretty simple: Flex containers do layout based on un-transformed children, and so rotated children are positioned as if there were no rotation, but then they're rotated around the top-left of that position. I've attached an image to show what I mean. Can I wrap the components in something? Or do I have to resort to custom components or fixed layouts? The image inlining doesn't look like it's working to me. Link to example image: [URL]

View 2 Replies

IDE :: Force SWF Into Right X & Y Position?

Aug 24, 2009

how to force a SWF from Top left corner to the correct position.. I wonder if it goes off because this script Im using is used on another MC? Two same scripts conflicting each other? Im just guessing here. This is the SCRIPT im using to load the SWF:

[Code]...

View 1 Replies

ActionScript 2.0 :: Flash8 Force SWF Into Right X&Y Position

Aug 24, 2009

Im trying to figure out how to force a SWF from Top left corner to the correct position..

I wonder if it goes off because this script Im using is used on another MC? Two same scripts conflicting each other?

This is the SCRIPT im using to load the SWF:

PHP Code:

myPlayer.visible = false;
loadMovieNum("Pano360.swf", 1);
_root.onEnterFrame = function(){
if(_level1){

[Code]....

View 1 Replies

ActionScript 3.0 :: Redimensioning Sprite But Not Its Children?

Jul 30, 2009

Is it possible to alter the width or height of a sprite dynamically without altering the width and height of its children ?

Even when I add children to a Sprite that had its dimensions altered dynamically, these children have their dimensions changed.

[Code]...

View 3 Replies

ActionScript 3.0 :: Sprite Is Larger Than Its Children?

Feb 2, 2011

I have sprites with dynamically created children: combo-boxes, buttons, and textfields. The number of children is variable and they're positioned vertically one under the other. If a sprite contains textfields only, its height corresponds to the joint height of all children + the spaces between them. In the case of sprites containing combo-boxes and buttons however, the sprite height is larger.

I may be on the wrong track here, but it seems that what is responsible is the object bounds. E.g. if my button height is 25 and getBounds returns 100, the sprite's height is larger by 75 pixels.The sprites are loaded into a scroll-pane, and depending on their size, the vertical bar is visible (or not). Obviously the above results in situations where a scroll-bar appears even though the entire contents of the sprite is visible, or one scrolls down to an empty space...Is there a way around this problem? Can object bounds be re-sized as well or can I overwrite this '100' value somewhere in Flash itself?

View 1 Replies

Force A SWF From Top Left Corner To The Correct Position?

Sep 27, 2009

how to force a SWF from Top left corner to the correct position.. When I tried to use a container it made the external swf not work at all, though it was in right position

WITH THIS CODE, THE SWF LOADED BUT JUST IN WRONG POSITION :
on (release) {gotoAndPlay(4);
loadMovie("gallery.swf",1);
}

then when I used a EmptyMovieClip it came in as the attachment.

Is there any other way to still use the LoadMovie() and adjust the x and y positions?

View 1 Replies

ActionScript 3.0 :: Checking If A Sprite/Movieclip Has Any Children

Oct 16, 2009

how do you check whether a certain mc or sprite has any children inside it... does the following do the trick?

[as]
if (mc.length > 0)
{
trace ("mc has children");

[Code]....

View 4 Replies

ActionScript 3.0 :: Duplicate A Sprite With All Its Children And Events?

May 10, 2011

I am trying to duplicate a sprite that I loaded a bunch of images in from an xml.

I even tried senocular's way of duplicating display objects and it just returned an empty sprite.

View 2 Replies

ActionScript 3.0 :: Resizing A Sprite Without Scaling/streching Its Children?

Nov 29, 2009

I have a Bitmap. Let's say it's 100x100 in size. I would like to display that bitmap on a Sprite that for the sake of this example is 100x50. Since the height of the bitmap is double than the height of the sprite - I would have liked the bitmap to be cropped (and to later implement a "scroll-down" mechanism) - HOWEVER, apparently:

1. The size of an "empty" sprite is defined by the size of its first children(s) - once I addChild the bitmap into the sprite - the sprite becomes 100x100 (If I try to define the size of the sprite to 100x50 before adding the child, and then adding it - then nothing is displayed).

2. If I then try to resize the sprite by modifying its Height property - the bitmap get's "scaled-down", or rather "squashed-in" to fit the new size.I'd like the bitmap to retain its original size (and be cropped at the bottom).Can it be done (without copyPixeling to a different bitmap etc.), and if so how?

btw:(3) If after all that I try to scale the bitmap back up (by changing scaleY) - then the sprite itself is again gets scaled and resized with it...

View 1 Replies

Actionscript 3 :: Parent Sprite And It's Children DisplayObjects Do Not Fade In/out Simultaneously

Dec 10, 2010

I'm trying to simulate some fade in/out effects in Action Script 3 programmatically, using Timer class and controlling alpha property of the specified DisplayObject in time. In general it works and looks great. As I was expecting. But after I add some more child DisplayObjects to the parent Sprite it starts to behave weirdly. Children seem to not fade at the same rate as parent object and it visually noticeable, and ugly. There seems to be a short lag after parent already started to fade out and before children actually follow. Are there any additional measures I should take to avoid that? I do alpha manipulation only on parent object. I thought that'd be logical...

View 2 Replies

ActionScript 3.0 :: Width Of DisplayObjectContainer - Make The Size Of Sprite Is Not Affected By Its Children?

Jan 30, 2010

look at the following codes first
 
var sp:Sprite = new Sprite();
trace( sp.width );                    // the result will be 0
var mc:DefinedMC = new DefinedMC();          // assume that DefinedMC is derived from movie clip, and the width of mc is 100
sp.addChild(mc);
trace( ap.width );                    // the result will be 100
 [code].....
 
so the size of an instance of Sprite is affected by its children.is there any class derived from DisplayObjectContainer whose size is not affected by its children, or is there any method that could make the size of Sprite is not affected by its children.

View 7 Replies

Actionscript 3 :: Setting Alpha On Parent Sprite Without Affecting Sprites Children

Mar 12, 2010

If I change some value for a parent sprite, the same value will affect all of its children. So if I set alpha or width on the parent, the child will automaticly get the same value.

View 4 Replies

ActionScript 2.0 :: Force A Mouse Follow Movieclip To Snap To A X Y Position If It Reaches X Y Boundaries?

Mar 30, 2009

How would you force a mouse follow movieclip to snap to a x y position if it reaches x y boundaries or perhaps if a button is released the movie clip snaps to a x y position? Of course if the mouse returns to x y boundaries I'd like for the movie clip to follow again.

Right now this is the code I'm using to make the movieclip follow the mouse within x y boundaries:

Code:
onClipEvent (load) {
_x = 0;
_y = 0;

[code]....

View 4 Replies

Actionscript 3 :: Re-position The Children Of A MovieClip?

Oct 14, 2011

I am having a container mc with 5 children mcs. children names mc0,mc1....mc4.

cont.getChildByName("mc"+Number(cont.numChildren-1)).x =
cont.getChildByName("mc0").x - 20 *1.2;

after this re-position process.. I want to set the last item position as 0 and so on. How can I do this?My target is to attain a circular movement.like

[mc0][mc1][mc2]
[mc2][mc0][mc1]
[mc1][mc2][mc0]
[mc0][mc1][mc2]

View 2 Replies

ActionScript 3.0 :: Order Children By X Position?

Sep 8, 2009

take the children of an object, the children are groups nested within a parent group, and sort them based on their x coordinate. so the one furthest left (lowest x) is in position 0 and so on.

View 3 Replies

ActionScript 3.0 :: Can't Reference An Instance Of A MC Through A Sprite

Apr 13, 2010

I thought since a Sprite is a display object container and I can add an instance of a MovieClip to it I should be able to reference the MC through the Sprite.
 
var bh1:Sprite = new Sprite();            beerChan = new BeerChan();            bh1.addChild(beerChan);            trace("bh1 "+bh1);            trace(bh1.beerChan);
 
1119: Access of possibly undefined property beerChan through a reference with static type flash.display:Sprite.

View 10 Replies

ActionScript 3.0 :: Reference A Sprite With A String?

Apr 6, 2012

I cant get the this[] keyword to work. I want to send a string to a function and then, via the string reference a Sprite. Are theire any other ways to adress a sprite with a String value?I thought this[myString].alpha = 0.5; was gonna do the trick but i keep getting (1010: A term is undefined and has no properties.). I tried every possible solution it feels like. Delaring Strings locally and Global...but i can�t get it to work.

PHP Code:

//Nothing Worksthis["myString"].alpha = 0.5;this[myString].alpha = 0.5;//Anyway to reference a Sprite with a String?

View 3 Replies

ActionScript 3.0 :: How To Reference A Sprite With A String

Feb 21, 2009

I want to send a string to a function and then, via the string reference a Sprite. Are theire any other ways to adress a sprite with a String value?I thought this[myString].alpha = 0.5; was gonna do the trick but i keep getting (1010: A term is undefined and has no properties.). I tried every possible solution it feels like. Delaring Strings locally and Global...but i cant get it to work. And the String is well spelled btw!

PHP Code:
//Nothin Worksthis["myString"].alpha = 0.5;this[myString].alpha = 0.5;//Anyway to reference a Sprite with a String??? 

[code]....

View 2 Replies

ActionScript 3.0 :: Reference A Sprite Or MovieClip Via A String?

Feb 21, 2009

I want to send a string to a function and then, via the string reference a Sprite. Are theire any other ways to adress a sprite with a String value?I thought this[myString].alpha = 0.5; was gonna do the trick but i keep getting (1010: A term is undefined and has no properties.). I tried every possible solution it feels like. Delaring Strings locally and Global...but i can�t get it to work. And the String is well spelled btw![code]

View 3 Replies

Actionscript 3 :: Modify Position Of Children Inside Loop?

Mar 3, 2010

I'm trying to make a dynamic image gallery from and xml. From my tutorials, right now i've got it so it will constantly add the next thumbnail below the other, which is fine, but I'm trying to figure out how to make it that once it reaches a certain y coordinate, it will move the x coordinate over and stack them again. So that rather one long list of thumbs, it will be a side by side stack. For some reason, I can't get it in my head how something like this would work. My goal is to have a side by side stack that I will end up putting in a movie clip that will be masked to show only 2 stacks at a time. Then when clicking a button will slide it over. I was planning to use the "movieclip.length" to calculate how far over to move it, but i haven't gotten that far yet. This is what I got:

[Code]....

View 1 Replies

Sprite Y Based On Mouse Position?

Jul 20, 2011

So I'm working on my portfolio and I got this problem. The code posted scrolls the sprite "cellContainer" based on the position of stage.mouseY. Perfect.Problem is that I want stage.mouseY to equal the entire cellContainer height. Kind of like how a small tablet equals a huge monitor. So when stage.mouseY = 0,cellContainer.y = 0 and when stage.mouseY = stage.stageHeight, cellContainer.y = stage.stageHeight - cellContainer.height. Right now, it scrolls, but it takes a while to scroll throught the entire height of cellContainer. I want it to be proportional to stage.mouseY.

Actionscript Code:
private function scrollStart(e:Event)[code]....

View 4 Replies

ActionScript 3.0 :: Reference Sprite Or Movieclip In Document Class

Dec 9, 2009

How do I reference MovieClips or Sprites created in the Document class from a custom class?[code]But I have a lot objects I want to reference so using the above method would take to long.I know I can do this to reference a MovieClip on the main stage from a custom class.[code]Would referencing the sprite created in the document class be similar?

View 1 Replies

ActionScript 3.0 :: Reference Sprite Or Movieclip In Document Class?

Dec 9, 2009

How do I reference MovieClips or Sprites created in the Document class from a custom classI know I can do this

ActionScript Code:
//Sprite I want to reference
var orange:Sprite  = new Sprite()

[code].....

View 1 Replies

ActionScript 3.0 :: Set X And Y Position Of A Class That Inherits From Sprite?

Feb 15, 2009

I have a clas that inherits from sprite but i want to know when the x and y is set so i can make changes inside the instance, but i cant figure out how to do that...

i need it so that say if i set the x with the normal x property, it can set another variable or run a function.

View 2 Replies

ActionScript 3.0 :: Two Sprite Objects - Adjusting Position (X And Y)

Jan 23, 2012

I am trying to do adjustment of position (x and y) of display objects, relative to other display objects. In other words: I have two Sprite objects (rectangle and circle). The rectangle can have their width changed during execution. Yet the circle has a fixed size. What I do is this: regardless of the width of the rectangle, the circle is positioned at the far right of this rectangle.

I tried as follows:
ActionScript Code:
rectangle.width = someValue;
circle.x = rectangle.x + (rectangle.width-circle.width);

In theory it should work, but look what happens:
imageshack.us/photo/my-images/837/positionq.png

As the width of the rectangle increases the distance from the desired location also increases.
Using:
ActionScript Code:
trace (rectangle.width);

I realized that the value of property 'width' does not match the exact amount of pixels that the object is wide. I just did a test and realized that this problem only happens when the rectangle has edge. When the rectangle has only fill, this problem does not occur.

View 9 Replies

ActionScript 3.0 :: Sprite X / Y - Values Reference Top Left Corner Or Center

Jun 3, 2010

I've checked this behaviour: If I define a sprite (by programming) as:
var square:Sprite = new Sprite();
square.graphics.beginFill(16750899, 1);
square.graphics.drawRect(0, 0, width, height);
square.graphics.endFill();
return square;
When I check the position of the sprite ( square.x, square.y), they reference the TOP-LEFT CORNER.

If I create a symbol by Flash CS4 and export to Actionscript (I also associate one class which extends Sprite for doing "new()" in my code):
var square: MyClassExtendsSprite = new MyClassExtendsSprite();
When I check the position of the sprite (x, y), they reference the CENTRE of the sprite!

View 3 Replies

ActionScript 3.0 :: Position A Loader Image Inside A Sprite?

Sep 18, 2009

In AS3 / CS4 I'm trying to programmatically create a bunch of rectangular objects, let's call them 'cards', that will contain an image and a colored background and eventually some other elements like text.  I want to create alot of these cards and move them around inside of a larger panel (also a Sprite) of sorts.  I can successfully create colored rectangles in my cards and place the cards where I want in the panel, but whenever I try to add an image to a card, I can't seem to position the image inside the card's coordinate space, it ends up being placed inside the larger panel's coordinate space instead, even though I'm adding the image/loader as a child of the card.  I thought maybe it had something to do with having to wait until the image loading was complete, so I added the listener as a test but that didn't work.  Here's the code:

[Code]...

View 1 Replies

ActionScript 3.0 :: Xml.children() Returns Grand-children And Gr8-gran-children?

Nov 18, 2009

I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)

Code:
<root>
<dir name="images">

[code]....

View 2 Replies







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