ActionScript 3.0 :: Scale An Added Sprite When Resizing An AIR Window?

Sep 12, 2009

I have an AIR app who has a canvas that scales when I resize the window. I have a sprite that is added to that canvas. When I scale the window the sprite does not scale with it.How do I tell the added sprite to scale with the canvas? Or tell it to be 100% of the container always?Right now I am listening for a resize event and resizing the sprite on that. But that seems like a waste of code/ too much of a CPU hog because I can easily add an element (using MXML) and tell it to be 100% of the parent and it will scale it on its own (EG without telling it to).

View 2 Replies


Similar Posts:


Actionscript 3 :: Resizing A Sprite Without Resizing Its BitmapFill (or Its Contents For That Matter)?

Nov 1, 2010

I am not simply trying to contain things and have the container resize without the contents resizing. I would just use a simple MovieClip for that.. My main focus is on the use of BitmapFill. I'm trying to make a repeating background image for a container; thus far I'm able to draw my BitmapFill sprite to the size I want. (Which is the stage's height) but when the stage is resized, I want to re-size my container but have my containers BitmapFill crop or add more as the window is resized bigger or smaller. Allow me to illustrate what I mean:

I've got a simple rectangle sprite that fills with a bitmap from the library and a simple resize handler function that detects when the window has been resized.what I would like to do is have my rectangle resize to the height of the stage.stageHeight maintaining its bitmap fill, but not resizing the bitmap fill or any children within the sprite.

From what I've read, this is a little tricky because the sprite resizes in relation to what it contains.. or.. something like that.. I really don't know any more.. I saw one example where a person extended the sprite class but I don't know why or how..

in my library there is an image called 'pattern' and my code looks like this:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, resizeHandler, false, 0, true);

[code]....

View 2 Replies

ActionScript 3.0 :: Resizing A Sprite Without Resizing Its Auto-fill?

Nov 2, 2010

I've got a little problem with BitmapFill, I'm trying to use a sprite as a container for various things and i would like it to have a filled pattern background. my problem is that i want it to resize the sprite to the height of the window but not have the background fill resize, and add more / crop as the window size is changed. to illustrate what i mean, please view the diagram attached to this post .

I have an image in my library called 'pattern' and my code is as follows:

ActionScript Code:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

[Code].....

View 2 Replies

IDE :: Flash Content To Scale When Scale Browser Window?

Feb 19, 2010

I want my flash content to scale when I scale my browser window.

View 5 Replies

ActionScript 2.0 :: Resizing The Window - Photos Will Popup In A Fullscreen Window

Apr 25, 2008

Go to [URL]. Click on "The Photos". It will pop up in a fullscreen window. Try resizing the window and you'll notice that the background is vector and it looks like the scale mode is set to "showAll". BUT, the photos look like they have a separate scale mode set to "noScale". They don't resize.

View 2 Replies

Flex :: Resizing The Restore-window Of A Maximized Window

Aug 11, 2009

I have a window, the window I programmatically change the size of the window depending on the current view it is displaying. The user cannot resize the window them self, but they can maximize the window.

The problem is if the view is changed while it is maximized, the maximized window size changes, I do not want this, I want it to only change the size of the non-maximized window.

My first thought is to just check if the window is maximized, and if so do not resize it...but the issue there is then when it is restored at a different view then when it was maximized it will not restore to the new size it should be.

View 2 Replies

ActionScript 3.0 :: Take For A Sprite To Be Added To The Displaylist?

May 28, 2009

I am having some trouble understanding the display list.  This might sound silly but how long does it take until a sprite is added to the display list?
 
My understanding is that the root variable is only accessible once the object is added to the display list.In the following code I add the TLSEntry_Text to the display list and then on the next line I try to trace its root variable without luck.  The root variable appears only in the enter frame event...  I guess a little bit later.
 
What am I missing here?  Is there a way for the display list to "force refresh" itself?

[Code]...

View 5 Replies

ActionScript 3.0 :: Resizing DropShadow Filter (Scale X / Y)

Feb 9, 2009

I was wondering whether it would be possible to perform operations on Filters, specifically the DropShadow filter, such as resizing it (scaleX scaleY).

View 7 Replies

ActionScript 3.0 :: Objects Added To Sprite / MC Not Appearing

Jun 24, 2010

I've been working on building a game and encountered a strange problem this morning when instead of adding objects directly to the stage I needed to add them to a Sprite (I also tried this with a MovieClip) which was on the stage instead and they did not appear. And yes, before anyone says it, the MC/Sprite that I'm adding the objects to has definitely been added to the stage, I've made that mistake before and don't plan on making it again

Essentially I have been building the game's levels using various different objects (rectangles, circles etc) built in the Box2D physics engine and with attached sprites to represent them to the user. When creating each of these object I supply a DisplayObjectContainer in which the sprite representing the object should be placed. Up until now I have been simply been supplying my core game class as the DisplayObjectContainer, with no problems whatsoever - everything is displaying fine.

A new level design, however, will require me to apply a mask to the entire level (but not the GUI) so I decided to place all the level objects within a MovieClip or Sprite instead. I have created the new sprite as such:

levelObjects = new Sprite();levelObjects.x = levelObjects.y = 0; //Just to make surelevelObjects.width = GameProperties.stageWidth;levelObjects.height = GameProperties.stageHeight;levelObjects.visible = true; //Just to make sureaddChild(levelObjects)

And have been supplying this sprite to the level objects as a DisplayObjectContainer instead of the core game class. Everything is getting added to the stage as I can click on things and the sounds associated with the game objects are playing correctly, but nothing is actually visible! As I mentioned above I tried this using a MovieClip instead but got the same result.

View 5 Replies

Actionscript 3 :: Sprite Added To Stage But Not Visible?

Nov 30, 2011

I'm trying to get a simple AS3 app up and running, and for some reason, I cannot get a sprite to show. At this point, all I want to do is get a red sprite to fill the stage.

public class Main extends Sprite
{
public function Main():void

[code].....

View 2 Replies

ActionScript 3.0 :: How To Scale Pictures - Image Resizing In Flash

Jun 6, 2010

How to scale pictures when doing website in FLASH. I am creating a flash based website for a friend. I have done all the links and it works great. The only thing is that the images increase as the web browser is maximised. I would like it to decrease as the web browser is decreased, but to increase to a certain size 900 x 651, and stay that size no matter how big the browser is increased by. This is what I am trying to create: [URL]

View 3 Replies

ActionScript 3.0 :: Scale Sprite With Mouse?

Jan 23, 2010

How might I go about making a sprite scale by dragging on it with the mouse? All my attempts so far have led to unexpected scaling effects...

View 1 Replies

Flash - Drawing Rectangle Or Resizing Sprite?

May 13, 2011

I have two options and I want to know whats faster. I have a pool of 1000 sprites objects in as3 on screen. When its needed each sprite has to resize itself. I can
1- Make each sprite a simple container to use graphics to draw a rectangle, that is, call a 'spriteInstance.graphics.' ,draw the rectangle and on each 'refresh', I do graphics.clear and redraw the rectangle but with the new size, this for each sprite.
or
2- Create each sprite with a border and on each refresh, resize it
Whats better?

View 1 Replies

ActionScript 3.0 :: Resize A Sprite Without Resizing Contents?

Feb 12, 2010

How do you resize a sprite without resizing the contents? For example the script below create a sprite, attaches it to the root, creates a button, attaches the button to the new sprite then resizes the sprite. but it scales the button when I try to resize?[code]...

View 9 Replies

ActionScript 3 :: How To Scale Width Of Sprite To Resize

Oct 24, 2011

I have a sprite in as3 code, I want to enter its height to resize it, how can I scale the width accordingly?
sprite.height = 200;
sprite.width = ??

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 :: Sprite Scale - Rectangle Is Clearly Larger Than 100x100 Pixels?

Nov 4, 2011

Here's a very simple AS3 project consisting of one class which draws a rectangle. When I run it, the rectangle is clearly larger than 100x100 pixels.

Edit: I know that it isn't correct because, though I have my screen resolution set to 1280x800, if I set the width to 500 it takes up almost all of my screen.

package
{
import flash.display.Sprite;
import flash.events.Event;[code]....

View 1 Replies

ActionScript 3.0 :: Change The Rotational/scale Point On A Object/sprite?

Jul 31, 2009

When you load a object through flash, you can set the rotational/scale point, but when you load it as a loader object or sprite, how do you change this point?

In this instance, I want to change the height of a sprite that is filled with a rectangle so that it shrinks down, not up.

Right now:

var colored_bar:Sprite = new Sprite();
with (colored_bar.graphics) {
beginFill(0x9e1819, 1);

[Code]....

The way I am doing it currently is moving the y position everytime I take away soem of the height, so it looks like it's moving down, but I'd think moving the orientation point at the beginning would be faster

View 2 Replies

ActionScript 2.0 :: Resizing Pop-up Window

May 18, 2005

i saw in some sites that a window pop-up in smaller size which contains preloader and resize to larger size(main content) when it loaded,how to do that?

View 1 Replies

ActionScript 2.0 :: Resizing Pop-up Window?

May 18, 2005

i saw in some sites that a window pop-up in smaller size which contains preloader and resize to larger size(main content) when it loaded,how to do that?

View 1 Replies

Resizing Bg To Fit To Window In Flash Movie

Sep 9, 2009

Ive got a bg image in my flash movie and I want it to resize it 100% to the window when the movie resizes in the browser, but i dont want anything else in the movie changing in size, just the bg..

View 1 Replies

ActionScript 3.0 :: Resizing Window Without Artifacts?

May 6, 2010

When I resize the desktop flash player, I can see artifacts of my flash movie that were outside of my canvas. How can I setup my flash movie with actionscript so that only black is show outside the canvas if the user resizes it?

View 6 Replies

ActionScript 2.0 :: Resizing A Full Window?

Apr 16, 2005

is there a way to tell flash in a button event to open a a html site (php-cgi) with a small size, lets say like 300px x 200pxThe html.site/php-cgi) id like to get openned and resized at 300x200 looks like this:
__________
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

[code].....

View 4 Replies

ActionScript 3.0 :: Scale Instances With Window?

Jun 7, 2011

What is the best way to scale instances with the window.

Simply put how should one tackle the white space that shows up when the .swf window is stretched further than where u plan to have instances or generally visual content.

View 1 Replies

ActionScript 3.0 :: Scale A MC With Window Size?

Jul 10, 2010

I have an image inside a MC called "hPic" and i want this MC to scale with the window when it's resized vertically, but it has to keep the same dimensions/aspect of the MC when it's scaled, not just stretch it vertically or the image will be distorted - so the proportions have to be constrained.

View 1 Replies

ActionScript 2.0 :: Setting Window To No Scale On Cd-rom?

Apr 20, 2007

So I'm making this CD-Rom in Flash using the .exe extension. It will automatically open to the size of the flash movie, but I want to set it so that they viewer can't resize the window.

I tried using: fscommand("allowscale", "false"); on the first frame of my movie but it didn't work.

View 1 Replies

ActionScript 2.0 :: Smooth Animation In MCs When Resizing Window?

Mar 23, 2010

I want to know how it's made the effect of smooth transition when the window is resized. I could make MCs get position through AS, scripting:

Actionscript Code:
mc._x;mc._y;mc._width;mc._height;

But I want to know how can I make it moving smoothly when the window is resized.

Example: [URL]

View 2 Replies

ActionScript 3.0 :: Centering Object When Resizing Window?

Aug 1, 2010

I've been playing around with a code that keeps a specific object on the center of the movie when the window is re-sized. It works well but here is the issue: I don't want the object to be centered at the very center of the window but on a specific x,y coordinate. How can I modify this code to assign an x,y coordinate so that the object will be "centered" in reference to that coordinate?

Next, is the code. "centerlogo" is the object to be centered and "backgroundImage" is as the name implies the background. I know that what i ask has to do with the part under the "//center content" comment

function init()
{
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;

[Code]....

View 5 Replies

Actionscript 3 :: AIR - Resizing Native Window Proportionately

Mar 8, 2011

my application launches with the stage size of 1000 x 500, 2:1 aspect ratio. the native window has system chrome, which will always be a little taller by a few pixels.how is it possible to only permit a native window to resize proportionately in order to always maintain the 2:1 aspect ratio of the stage?[code]

View 1 Replies

Actionscript 3 :: Container Resizing According Window Resize?

Jan 17, 2012

I have a window witch is resizing on creationcomplete phase according user preference. This part woks well. But inside this window a s:Group (maincontainer2) exists and even if width and height is in percent, the s:Group size is bigger that the new window measure.

<?xml version="1.0" encoding="utf-8"?>
<windowSkin:wCustomWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"

[Code].....

View 1 Replies







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