Size of avm1movie in as3

Hi,
I'm developing a new website in as3, and would simply like to
load the adobe media gallery (as2) swf for one section. I'm new to
flash, but have managed to get the as2 content to load. The trouble
is that the as2 movie expands to the size I've defined in HTML for
the as3 movie, pushing the as3 content off to the side and below.
How do I make this as2 swf work within the scale of the as3 movie?
When I try eg. loader.content.width, the loader content doesn't
show up but still resizes the embedding as3.
var loader:Loader = new Loader();
var url:String = "resources/gallery.swf";
var request:URLRequest = new URLRequest(url);
var container:Sprite = new Sprite();
addChild(container);
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
swfLoaded);
function swfLoaded(e:Event):void {
container.addChild(loader.content);
Best,
Dylan Oliver

you should be using:
VideoScaleMode.MAINTAIN_ASPECT_RATIO.

Similar Messages

  • Stage dimensions(size) in Flash CS4 (AS3)

    Hi again,
    I need to know how to get the dimensions of my stage (x,y), BUT only the stage and not all the objects that might continue off the stage included.
    For example :
         My stage is 400 x 550.
         I want to get 400 and 550 returned.
    Thank you for any help and tips!

    You can use:
    var nW:Number = stage.stageWidth;
    var nH:Number = stage.stageHeight;

  • Print in A4 size paper through AS3 using Flash CS5

    Hi all,
    Is any idea to print a job in A4 paper size by defult through AS3 using Flash CS5?

    Hi Shakeel,
    I am already having customised page format .
    It works fine when I choose Standard Device type EPLQ550
          But EPLQ550 is probably not supporting Arabic text.   It Gives ########
    Thats why I changed to Standard Device type ARSWIN
        Now Arabic text looks ok..... but Printer is not getting initialised after the first check. it skps.
    Pl suggest
    Thanks
    SK

  • Native Extensions in Workers

    Hello,
    I'm starting with Workers from Android. Seems to work well for simple tasks, however I can I use Native Extensions within workers ?

    Maybe I'm not explained myself very well. YES, I tested and tryed everything !
    I need two Workers:
    The first one is very simple and use sqlite and is working simple perfectly.
    The second one use one ANE that I created my self for integration with a bluetooth device. If I change the ANE to SWC and include this as a library, the SWF worker increase the size and recognize the AS3 classes however I got and error when the AS3-ANE try to instantiante the jar code part, because this is a SWC library and not an ANE anymore !
    Seems that ANEs are only supported in Flex Desktop/Flex Mobile projects and not librarys and the worker is.

  • Pixelbander "eats" memory

    I tried to just mix the two images, using your crossfade shader example.
    Images size 640*480 each.
    as3 source here.
    public class shaders extends Sprite
    [Embed(source="i1.jpg")]
    private var k_i1:Class;
    private var b_i1:Bitmap = new k_i1();
    [Embed(source="i2.jpg")]
    private var k_i2:Class;
    private var b_i2:Bitmap = new k_i2();
    [Embed("../pbj/crossfade.pbj", mimeType="application/octet-stream")]
    private var shad:Class;
    private var dstBd:BitmapData = new BitmapData(640, 480, false, 0xFF00FF00);
    private var bmp:Bitmap = new Bitmap(dstBd);
    private var shader:Shader = new Shader(new shad() as ByteArray);
    public function shaders()
    addChild(bmp);
    addChild(new Stats());
    addEventListener(Event.ENTER_FRAME, onFrame);
    shader.data.frontImage.input = b_i1.bitmapData;
    shader.data.backImage.input = b_i2.bitmapData;
    shader.data.intensity.value = [0.5];
    public function onFrame(e:Event):void
    dstBd.lock();
    var shJob:ShaderJob = new ShaderJob(shader, dstBd, 256, 256);
    shJob.start(true);
    dstBd.unlock();
    Memory jumps from 6 to 170 megabytes, and vice versa.
    What am I doing wrong?
    Examples from the internet is working fine.
    FlashBuilder4, FP10.1, SDK from 3.5 to the last Hero.

    for this bug:
    http://bugs.adobe.com/flashplayer/
    In general Flash Player Pixel Bender bugs go there and PS/AE/PB Toolkit bugs should go here.
    thanks!

  • [AS3 AIR] 2880x2880 Size Limit, Camera, Filter, CameraRoll Issues & Finger Friendly Components

    AS3 AIR ANDROID
    I started playing with this Adobe AIR for Adroid by building an app that would let the user take a picture using the mobile device's native camera app.  Then, I'm applying filter effects to make the image look cool.  Then, I'm allowing the user to save the image back to the camera roll.
    Here are some questions that I have:
    KEEPING UP WITH CURRENT TECHNOLOGY
    Are we limited to the 2880x2880 stage size limit?  Although, this dimension does yield 8+megapixels, it's not in the ratio that most camera sensors are built (widescreen).  Plus, you can bet that newer cameras will have even higher dimensions.  Will this be updated to keep up with current technology requirements?
    IMPORTING & MANIPULATING CAMERA DATA
    Code
    var bmpData:BitmapData = new BitmapData($loader.width, $loader.height);
    bmpData.draw(DisplayObject($loader));
    bmp = new Bitmap(bmpData);
    bmp.width = Capabilities.screenResolutionX;
    bmp.height = Capabilities.screenResolutionY;
    if (CameraRoll.supportsAddBitmapData) {
        var cameraRoll:CameraRoll = new CameraRoll();              
        cameraRoll.addEventListener(ErrorEvent.ERROR, onCrError);
        cameraRoll.addEventListener(Event.COMPLETE, onCrComplete);
        var savedBmpData:BitmapData = new BitmapData (bmp.width, bmp.height);
        savedBmpData.draw(DisplayObject(bmp));
        cameraRoll.addBitmapData(savedBmpData);
    } else {
        trace("~" + "Camera Roll not supported for this device.");
    addChild(bmp);
    When you capture an image using the mobile device's camera app, you have to use the Loader object.
    So, here, I am doing just that with these steps:
    First, I'm creating a BitmapData object and sizing it the same as the camera image.
    Pass the camera image into the BitmapData object.
    Create a Bitmap object and pass in the BitmapData.
    Resize it to fit on the stage.
    Check for Camera Roll and then create a savedBmpData BitmapData object at the size of the screen.
    Pass in the bmp.
    Save it to the Camera Roll.
    The problem is that when the image is displayed on the phone, it shows THE ENTIRE (uncropped) image.  However, the image that is saved to the phone is only the top 800x480 corner of the image.  What is wrong?  How do we save an image to the Camera Roll that is larger than the display area of the phone.  It seems like the only way to save the entire camera image is to resize it to fit the stage and then capture the stage into a bitmapData object.
    FILTERS
    If you apply any filters to the bitmapData object, the filter effects will display on the phone, but if the image is saved to the Camera Roll, then all the filters are lost and it only saves the original (unfiltered) image.
    FINGER FRIENDLY UI COMPONENTS
    Do they exist?
    ADDITIONAL NOTES
    The max image size that can be saved is 2039x2039 pixels on the HTC Evo.  Anything bigger than this resulted in a CameraRoll Error #1 (which there is no documentation for what that means ANYWHERE on the web).

  • AS3 swf loaded as AVM1Movie

    I have an as3 proj in flex.
    I have a custom class Screen which is complied into a swf (by
    flex)
    I'm loading this file via a Loader..., then passing data up
    to it on INIT.
    fine that works great for the first time, second time, then
    on the third time nothing.
    when I trace for the type of the Loader.content, the first
    two times it traces [Screen,Object] as expected but on the third
    time it traces [AVM1Movie, Object].
    what's this about?? is it some security thing??
    the relevent code is below - the path resolves in all cases
    to the same path (..../SimpleScreen.swf)
    // ActionScript file
    package gs.ctl
    // imports
    import flash.display.DisplayObjectContainer;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.net.URLRequest;
    import flash.system.ApplicationDomain;
    import flash.system.LoaderContext;
    import gs.mdl.LoadXmlUnicode;
    import gs.vw.Screen;
    import mx.utils.StringUtil;
    import utils.LogEvent;
    public class Navigator extends EventDispatcher implements
    INavigator{
    private var _currentScreenLoader:Loader
    private var _currentScreen:Screen
    private var _currentScreenXml:XML
    private var _screenSetXml:XML
    private var _rootScreen:DisplayObjectContainer
    private var _pathUserRoot:String
    private var _pathData:String
    private var _pathAssets:String
    private var _URLscreenSet:String
    private var _legalScreenItems:XMLList
    private function _changeScreen():void{
    var URLReq:URLRequest = new
    URLRequest(_pathUserRoot+"\\"+_pathAssets+"\\"+_currentScreenXml.url);
    var context:LoaderContext = new LoaderContext();
    context.applicationDomain = ApplicationDomain.currentDomain;
    _currentScreenLoader=new Loader();
    _currentScreenLoader.contentLoaderInfo.addEventListener
    (Event.INIT, _initHandler)
    _currentScreenLoader.load(URLReq, context);
    private function _initHandler(event:Event):void{
    if(_rootScreen.numChildren==2)_rootScreen.removeChildAt(0)
    trace("type = "+_currentScreenLoader.content)
    _currentScreen=Screen(_currentScreenLoader.content);
    _rootScreen.addChild(_currentScreen)
    _currentScreen.setData(screenXml, _legalScreenItems,
    _pathUserRoot+"\\"+_pathAssets+"\\");
    _currentScreenLoader.unload();

    -- When u say first time, seccond.... you mean each time you
    compile your flex applicaction?
    I mean every time the changeScreen function is called... ie
    at run time.
    strange eh??
    this is no longer an urgent issue, as i've change the
    architecture now (much better :~) but I would like to know whats
    happening

  • Size of sprite different in AS3 and Flash

    When i do a Select All of my symbol in Flash I get a height
    (lets say 300x300). Even if there are multiple items, it groups
    them together to give me the total size.
    In AS3 I never get the same size. I have tried calling
    getRect(), width/height, etc... I get a different size, it's close
    but still invalid, sometimes smaller, sometimes larger.
    To replicate this:
    1. Create a new sprite with some text, add some paint
    brushes, etc..
    2. Add the sprite to the stage and notice its width and
    height
    3. Give the sprite an instance name (in this case I called it
    "block")
    4. Add a document main source file and add the following code
    to the constructor (from the bottom of the script)
    You will see that the size the code tells you and the size
    the flash editor gives are different. Is this a bug?

    1) yes the sprite is on the stage. It is accessible by AS3
    just the size is wrong.
    2) no, the sprite is not always a whole pixel, sometimes the
    size in Flash may be 300.50 x 210.90 etc..

  • How to  affect size of movies using loadMovie CS4, as3

    I have loaded a .swf into my main timeline, but it's quite large. I am trying to get it to fit in the constraints of my current movie. I have read that by putting it into a movie clip, it will constrain to that dimension. How do I accomplish this?

    If you know what scaleX and scaleY you will need you could just add it your code. Something like this:
    loader.scaleX=loader.scaleY=50;
    But if the content you will load is of different sizes and will maybe need different scales you could use code like below.
    import flash.display.Loader;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.net.URLRequest;
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete)
    loader.load(new URLRequest("banner.swf"));
    addChild(loader);
    function handleComplete(e:Event){
    var target:Loader=Loader(e.currentTarget.loader);
         trace(target.width)
    Depending upon what you need to do you could change that trace to some kind of measurement of the width and then use some arithmetic to scale the clip to a specific size.

  • Flash CS4/AS3 auto-size movieclip box containing TextField

    I have a TextField that I'm going to populate dynamically in code.  Imagine as a simple example a cartoon with the text bubble above the speaker's head, the bubble is a rounded rectangle with some embellishments like drop shadow and a border and such, and I want the bubble to be a fixed width but a variable height to accomodate a few words or maybe a long sentence that wraps to three lines.  I understand that TextField will do this with autosize and wordwrap, but how do I make the 'bubble' movieclip that contains it also resize accordingly, without writing various hacks involving counting the number of characters and resizing the bubble myself?  Thanks!

    assign your bubble a scale9grid and then assign its height based on your textfield's height.

  • Need help with finding picture size

    ok here is  my problem i have this sphere and it works great except when you click the thumbnails to display the picture, depending on the size of the picture, the pictures can get pushed to far over, and i understand why. the x and y coord never change. now my idea is to get the size of picture and use that to adjust the x-coord accordingly. my question is. how do i get the picture size? if i can. do the pictures have to be in the fla?
    heres code:
    The radius of the sphere, 'rad'. You can change it if you wish
    especially if you use thumbnails of a different size than our thumbnails.
    var rad:Number=380;
    The position of 'board' that will be defined later. 'board' is the main
    container containing the sphere and the black background
    that reponds to mouse actions.
    var posX:Number=stage.stageWidth/2;
    var posY:Number=stage.stageHeight/2;
    The size of thumbnails. Change the values to reflect the size of your
    images.
    var thumbWidth:Number=70;
    var thumbHeight:Number=53;
    The thumbnail images have been imported to the Library and linked to AS3
    under the names 'Small1', 'Small2',....,'Small46'. The corresponding
    Bitmap objects will be stored in the array 'thumbsArray'.
    var thumbsArray:Array=[];
    The addresses of the images corresponding to the thumbnails are stored
    in 'picsArray'. The images will be loaded at runtime when the user
    clicks on each thumbnail.
    var picsArray:Array=[];
    The Bitmap object corresponding to each thumbnail will be placed
    in a Sprite, holdersArray[i][j], as its child. We have to do this
    to make thumbnails responsive to mouse clicks.
    var holdersArray:Array=[];
    In order to depth-sort images on the sphere, we will need to keep
    track of their midpoints and the position of each midpoint in 3D.
    The midpoints will be stored in 'midsArray'.
    var midsArray:Array=[];
    The only part of our spherical menu that is hard-wired (and a bit harder
    to customize) is the number of thumbnails and their placement on the sphere.
    We have 46 thumbnails placed along 7 horizontal 'circles' on the sphere.
    The 'jLen' vector describes the number of thumbnails on each circle.
    The first 'circle' is the north pole and contains 1 image; the second
    is the circle corresponding to the vertical angle of 30 degrees
    from the negative y axis. That circle contains 6 images. The next one,
    at 60 degree of vertical displacement contains 10 images;
    the one after that, at 90 degrees from the negative y axis, is the equador
    of the sphere and contains 12 images. Past that, we go symmetrically:
    10, 6, and 1 image at the south pole.
    All our arrays are organized to reflect that placement of thumbnails.
    For example, thumbsArray is an array of arrays, thumbsArray[i], where
    i corresponds to the number of each circle. thumbsArray[i][j] is the
    j-th image on the i-th of the seven circles.
    var jLen:Vector.<Number>=new Vector.<Number>();
    jLen=Vector.<Number>([1,6,10,12,10,6,1]);
    We use the almost standard parametrization of a sphere:
    phi is the vertical angle measured from the vertical axis
    pointing upwards (in Flash's coordinate system this is the negative
    y-axis), theta is the horizontal angle measured from the
    horizontal axis pointing away from the screen; that is,
    the negative z-axis. phi changes from 0 to 90 degrees,
    theta from 0 to 360 degrees. For each circle, phi is constant:
    0, 30, 60, 90, 120, 150, 180. 'thetaStep' contains the angular
    distances between thumbnails on each circle. Except
    for the north and the south pole, for each circle
    the angular distance between thumbnails equals to 360 divided
    by the number of thumbnails on the circle.
    var thetaStep:Vector.<Number>=new Vector.<Number>();
    thetaStep=Vector.<Number>([0,60,36,30,36,60,0]);
    //The vertical angle between circles.
    var phiStep:Number=30;
    To make images tangent to the sphere, we need to tilt them
    vertically and horizontally. Horizontal tilt is always
    equal to the theta angle of the midpoint
    of the image and changes along each circle;
    the vertical tilt is based on the values
    of phi and is constant for each circle of thumbnails.
    var phiTilt:Vector.<Number>=new Vector.<Number>();
    phiTilt=Vector.<Number>([-90,-60,-30,0,30,60,90]);
    //The next four variables are related to auto-rotation
    //and rotation by the user.
    var autoOn:Boolean=true;
    var manualOn:Boolean=false;
    var prevX:Number;
    var prevY:Number;
    //The amount of perpective distortion. Higher values give more distortion.
    //Values have to be between 0 and 180 as they correspond to the view angle.
    this.transform.perspectiveProjection.fieldOfView=70;
    //We define and position the container 'board'.
    var board:Sprite=new Sprite();
    this.addChild(board);
    board.x=posX;
    board.y=posY;
    //We call the function that draws the border and the background
    //of 'board'.
    drawBoard();
    //Settings for our dynamic text boxes present on the Stage.
    infoBox.mouseEnabled=false;
    infoBox.wordWrap=true;
    infoBox.text="";
    loadBox.mouseEnabled=false;
    loadBox.wordWrap=true;
    loadBox.text="";
    loadBox.visible=false;
    When the user double-clicks on a thumbnail, the corresponding image
    will be loaded into 'loader' - an instance of the Loader class.
    'loader' is a child of the Sprite, 'photoHolder', which is a child
    of the MainTimeline.
    var photoHolder:Sprite=new Sprite();
    this.addChild(photoHolder);
    photoHolder.x=200;
    photoHolder.y=100;
    var loader:Loader=new Loader();
    photoHolder.addChild(loader);
    photoHolder.visible=false;
    We will literally 'build' a shere of thumbnails by positioning
    them in a Sprite called 'spSphere'. The moment we assign
    any of the 3D properties to 'spSphere', for example a value for the z coordinate,
    spSphere becomes a 3D container. That means we can place elements in it
    in 3D. We will also be able to apply 3D methods to 'spSphere', e.g. rotations.
    When 'spSphere' becomes a 3D display object, it has transfrom.matrix3D property.
    The latter property holds all the information about the current 3D state
    of 'spSphere'.
    var spSphere:Sprite=new Sprite();
    board.addChild(spSphere);
    spSphere.x=0;
    spSphere.y=0;
    //We move 'spSphere' backwards to avoid distortion of the front thumbnails.
    //You can experiment with different values for the z coordinate.
    spSphere.z=rad;
    //We call several functions defined later in the script.
    //They names tell it all.
    setUpPics();
    buildSphere();
    spSphere.rotationY=0;
    spSphere.rotationX=0;
    spSphere.rotationZ=0;
    spSphere.filters=[new GlowFilter(0x666666,1.0,6.0,6.0,2)];
    rotateSphere(0,0,0);
    setUpListeners();
    //The function that draws the black rectangle behind our sphere.
    //You can change the values below to change the size and the color
    //of the background. Those values do not affect the sphere itself.
    function drawBoard():void {
          board.graphics.clear();
          board.graphics.lineStyle(0,0x333333);
          board.graphics.beginFill(0x000000, 0);
          board.graphics.drawRect(-640,-490,1180,1080);
          board.graphics.endFill();
    //We add all the necassary listeners. They are self-explanatory.
    //Note that holdersArray[i][j] is the Sprite that contains the
    //j-th thumbnail on the i-th circle.
    function setUpListeners():void {
              var i:int;
              var j:int;
              this.addEventListener(Event.ENTER_FRAME,autoRotate);
              board.addEventListener(MouseEvent.ROLL_OUT,boardOut);
              board.addEventListener(MouseEvent.MOUSE_MOVE,boardMove);
              board.addEventListener(MouseEvent.MOUSE_DOWN,boardDown);
              board.addEventListener(MouseEvent.MOUSE_UP,boardUp);
              loader.contentLoaderInfo.addEventListener(Event.COMPLETE,doneLoad);
              loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,loadingError);
              photoHolder.addEventListener(MouseEvent.CLICK,holderClicked);
             for(i=0;i<7;i++){
                for(j=0;j<jLen[i];j++){
                    holdersArray[i][j].doubleClickEnabled=true;
                    holdersArray[i][j].addEventListener(MouseEvent.DOUBLE_CLICK,picClicked);
    The functions that are executed in response to events to which we listen.
    The next one runs when a loaded picture is clicked.
    function holderClicked(e:MouseEvent):void {
        board.visible=true;
        photoHolder.visible=false;
        infoBox.text="";
        manualOn=false;
        autoOn=true;
    'picClicked' is executed when any of the thumbnails is double-clicked.
    Note that in the function 'buildSphere' below, we assigned names to
    all holders, holderArray[i][j]. We need those names now to know
    which thumbnail was clicked and which image to load.
    function picClicked(e:MouseEvent):void {
        var targName:String="Double Click Image To View";
        var i:int;
        var j:int;
        targName=e.currentTarget.name;
        i=int(targName.charAt(3));
        j=int(targName.substring(5,targName.length));
        board.visible=false;
        loader.load(new URLRequest(picsArray[i][j]));
        infoBox.text="";
        loadBox.text="Loading...";
        loadBox.visible=true;
    function loadingError(e:IOErrorEvent):void {
        loadBox.text="There has been an error loading the image. The server may be busy. Refresh the page and try again.";
    function doneLoad(e:Event):void {
        infoBox.text="Click the image to close it.";
        photoHolder.visible=true;
        loadBox.text="";
        loadBox.visible=false;
    //Listeners responsible for mouse rotations and auto-rotation.
    function autoRotate(e:Event):void {
             if(autoOn && !manualOn){
                 spSphere.transform.matrix3D.prependRotation(-0.5,Vector3D.Y_AXIS);
                 zSortPics();
    function boardOut(e:MouseEvent):void {
                autoOn=true;
                manualOn=false;
    function boardDown(e:MouseEvent):void {           
                prevX=board.mouseX;
                prevY=board.mouseY;
                autoOn=false;
                manualOn=true;
    function boardUp(e:MouseEvent):void {
                manualOn=false;
         function boardMove(e:MouseEvent):void {
                    var locX:Number=prevX;
                    var locY:Number=prevY;
                    if(!autoOn && manualOn){
                    prevX=board.mouseX;
                    prevY=board.mouseY;
                    rotateSphere(prevY-locY,-(prevX-locX),0);
                    e.updateAfterEvent();
    The function setUpPics populates the arrays thumbsArray and picsArray.
    Note the organization of thumbnails by circles on which they reside:
    thumbsArray[0] - the north pole, thumbsArray[1] thumbnails of the first circle
    down from the north pole, etc. 'picsArray' is organized similarly.
    You can, of course, subsitute your own images, use thumbnails of
    dimensions different from ours. Changing the number of thumbnails and their organization
    would, however, require rewritting the script a bit.
    function setUpPics():void {
        thumbsArray[0]=[new Bitmap(new Small1(70,46))];
        picsArray[0]=["pic1.jpg"];
        thumbsArray[1]=[new Bitmap(new Small2(70,105)),new Bitmap(new Small3(70,105)),new Bitmap(new Small4(70,53)),new Bitmap(new Small5(70,53)),new Bitmap(new Small6(70,53)),new Bitmap(new Small7(70,53))];
        picsArray[1]=["pic2.jpg","pic3.jpg","pic4.jpg","pic5.jpg","pic6.jpg","pic7.jpg"];
        thumbsArray[2]=[new Bitmap(new Small8(70,53)),new Bitmap(new Small9(70,53)),new Bitmap(new Small10(70,53)),new Bitmap(new Small11(70,53)),new Bitmap(new Small12(70,53)),new Bitmap(new Small13(70,53)),new Bitmap(new Small14(70,53)),new Bitmap(new Small15(70,53)),new Bitmap(new Small16(70,53)),new Bitmap(new Small17(70,53))];
        picsArray[2]=["pic8.jpg","pic9.jpg","pic10.jpg","pic11.jpg","pic12.jpg","pic13.jpg","pic1 4.jpg","pic15.jpg","pic16.jpg","pic17.jpg"];
        thumbsArray[3]=[new Bitmap(new Small18(70,53)),new Bitmap(new Small19(70,53)),new Bitmap(new Small20(70,53)),new Bitmap(new Small21(70,53)),new Bitmap(new Small22(70,53)),new Bitmap(new Small23(70,53)),new Bitmap(new Small24(70,53)),new Bitmap(new Small25(70,53)),new Bitmap(new Small26(70,53)),new Bitmap(new Small27(70,53)),new Bitmap(new Small28(70,53)),new Bitmap(new Small29(70,53))];
        picsArray[3]=["pic18.jpg","pic19.jpg","pic20.jpg","pic21.jpg","pic22.jpg","pic23.jpg","pi c24.jpg","pic25.jpg","pic26.jpg","pic27.jpg","pic28.jpg","pic29.jpg"];
        thumbsArray[4]=[new Bitmap(new Small30(70,53)),new Bitmap(new Small31(70,53)),new Bitmap(new Small32(70,53)),new Bitmap(new Small33(70,53)),new Bitmap(new Small34(70,53)),new Bitmap(new Small35(70,53)),new Bitmap(new Small36(70,53)),new Bitmap(new Small37(70,53)),new Bitmap(new Small38(70,53)),new Bitmap(new Small39(70,53))];
        picsArray[4]=["pic30.jpg","pic31.jpg","pic32.jpg","pic33.jpg","pic34.jpg","pic35.jpg","pi c36.jpg","pic37.jpg","pic38.jpg","pic39.jpg"];
        thumbsArray[5]=[new Bitmap(new Small40(70,53)),new Bitmap(new Small41(70,53)),new Bitmap(new Small42(70,53)),new Bitmap(new Small43(70,53)),new Bitmap(new Small44(70,53)),new Bitmap(new Small45(70,53))];
        picsArray[5]=["pic40.jpg","pic41.jpg","pic42.jpg","pic43.jpg","pic44.jpg","pic45.jpg"];
        thumbsArray[6]=[new Bitmap(new Small46(70,53))];
        picsArray[6]=["pic46.jpg"];
    In the next function we actually create a 3D sphere of thumbnails by positioning
    them in 3D within spSphere. Note the center of the sphere is at (0,0,0) of
    spSphere. It might be worth recalling that with our interpretation of
    phi and theta each point P=(x,y,z) on the sphere corresponding to given values
    of phi and theta is given by:
    x = rad * sin(phi) * sin(theta),
    y = -rad * cos(phi),
    z = -rad * sin(phi) * cos(theta).
    Within the function, we populate 'holdersArray' and 'midsArray'. We assign thumbnails
    to holdersArray elements, position holdersArray elements, tilt them, give them names.
    We literally build our sphere.
    function buildSphere():void {
        var i:int;
        var j:int;
        var tStep:Number;
        var pStep:Number=phiStep*Math.PI/180;
        for(i=0;i<7;i++){
            holdersArray[i]=[];
            midsArray[i]=[];
            tStep=thetaStep[i]*Math.PI/180;
            for(j=0;j<jLen[i];j++){
                midsArray[i][j]=new Vector3D(rad*Math.sin(i*pStep)*Math.sin(j*tStep),-rad*Math.cos(i*pStep),-rad*Math.sin(i*p Step)*Math.cos(j*tStep));
                holdersArray[i][j]=new Sprite();
                holdersArray[i][j].name="pic"+String(i)+"_"+String(j);
                holdersArray[i][j].addChild(thumbsArray[i][j]);
                thumbsArray[i][j].x=-thumbWidth/2;
                thumbsArray[i][j].y=-thumbHeight/2;
                spSphere.addChild(holdersArray[i][j]);
                holdersArray[i][j].x=midsArray[i][j].x;
                holdersArray[i][j].y=midsArray[i][j].y;
                holdersArray[i][j].z=midsArray[i][j].z;
                holdersArray[i][j].rotationX=phiTilt[i];
                holdersArray[i][j].rotationY=-j*thetaStep[i];
          zSortPics();
    'zSortPics' depth-sorts all thumbnails corresponding to each view of
    the sphere. It sorts thumbnails by removing them (or more precisely
    their holders, holdersArray[i][j], as children of spSphere and then reassigning
    them based on the z-coordinates of their midpoints.
    function zSortPics():void {
        var distArray:Array=[];
        var dist:Number;
        var i:int;
        var j:int;
        var k:int;
        var curMatrix:Matrix3D;
        var curMid:Vector3D;
        curMatrix=spSphere.transform.matrix3D.clone();
        while(spSphere.numChildren>0){
            spSphere.removeChildAt(0);
            for(i=0;i<7;i++){
                for(j=0;j<jLen[i];j++){
                curMid=curMatrix.deltaTransformVector(midsArray[i][j]);
                dist=curMid.z;
                distArray.push([dist,i,j]);
          distArray.sort(byDist);
          for(k=0;k<distArray.length;k++){
              spSphere.addChild(holdersArray[distArray[k][1]][distArray[k][2]]);
              holdersArray[distArray[k][1]][distArray[k][2]].alpha=Math.max(k/(distArray.length-1),0.5) ;
    function byDist(v:Array,w:Array):Number {
         if (v[0]>w[0]){
            return -1;
          } else if (v[0]<w[0]){
            return 1;
           } else {
            return 0;
    The function that rotates the sphere in response to the user moving the mouse.
    Note we are setting the z coordinate to 0 before rotation. Otherwise,
    the non-zero translation coefficients produce undesirable effects.
    Note also that we do not use this function in 'autoRotate'. That is because
    when the sphere auto-rotates we want it to revolve about is pole-to-pole
    axis. That means prepending rather than appending rotation.
    See the function 'autoRotate' above.
    function rotateSphere(rotx:Number,roty:Number,rotz:Number):void {
          spSphere.z=0;
          spSphere.transform.matrix3D.appendRotation(rotx,Vector3D.X_AXIS);
          spSphere.transform.matrix3D.appendRotation(roty,Vector3D.Y_AXIS);
          spSphere.transform.matrix3D.appendRotation(rotz,Vector3D.Z_AXIS);
          spSphere.z=rad;
          zSortPics();

    I won't be searching thru all that code to try to find something relevant to your post, but if you are using a Loader to load the images, you can get the width and height as soon as the loading is complete using the loader object (loader.width, loader.height).  You just need to wait until loading is complete, so you'll need a listener for that if you don't have one already.

  • How to change the size of every object in a flash file

    i created a flash website but the problem is the size is to large to fit on screen i have imbeded buttons, Movies clips, masks, and about 7 different scenes in this 13 mb movie what do i do to make the physicle size of the objects on screen so i can view it on my sceen?

    the easiest thing to do would be to load your swf into a main swf and resize the target movieclip (as2) or loader (as3) after loading is complete.

  • ANN vCam AS3

    Announcing vCam AS3 for Flash. For those of you who are
    unfamiliar with vCam, I’ll give you a brief explanation. In
    2005, Sham Bhangal and Dave Dixon released the original vCam or
    “virtul camera” for Flash. Let’s say you are
    working on an animation and you want the animation to pan from left
    to right. Normally you would have to create tweens for all the
    layers in your timeline. However, the vCam allows a Flash developer
    to animate a single vCam instance on the timeline to create the
    same pan. Simply place the vCam on left side of the stage and
    create a motion tween to the right side of the stage. Publish out
    your file and bam! You’ve just made your scene pan with a
    single tween. Pans aren’t the only thing you could do with
    vCam. You could also change it’s size and add color
    transformations.
    Now vCam AS3 brings a whole new list of features, including:
    - Rotation
    - Blur
    - Brightness/Contrast
    - Hue/Saturation
    - and more!
    Visit
    www.bryanheisey.com for more
    information and download the source for free.

    As this does sound nice, please refrain from advertising
    here. Read the posting guidlines
    "We gave at the office! No advertising or solicitation is
    permitted on Adobe's Online Forums. However, if you have an
    announcement to make that is of direct interest to a particular
    forum topic - a single post is acceptable, as long as you add 'ANN'
    (for 'announcement') to the beginning of your subject line. This
    way people who are not interested can easily skip past your post."
    So, maybe you could change your topic title to read "ANN vCam
    blah blah". However, it really should be in the ActionScript 3
    forums, and not under general.

  • Motion Tweens in AS3

    I'm trying to make a screen object(digitB1_mc) move in one of two different directions, depending upon the current cicumstances.
    I drew the Motion Tween _B1_12 and saved it as a preset for the first direction.
    I drew the Motion Tween _B1_21 and saved it as a preset for the second direction.
    Then I tried to find AS3 code to grab one of these two from the presets and apply it to digitB1_mc. Could not find a way to do it.
    Then I copied _B1_12 to Actionscript 3.0 code (ie. clipboard) and pasted it into an Actionscript 3.0 function B1_12 and got:
    function B1_12() {
    import fl.motion.AnimatorFactory;
    import fl.motion.MotionBase;
    import fl.motion.Motion;
    import flash.filters.*;
    import flash.geom.Point;
    var __motion_digitB1_mc:MotionBase;
    if(__motion_digitB1_mc == null) {
        __motion_digitB1_mc = new Motion();
        __motion_digitB1_mc.duration = 11;
        // Call overrideTargetTransform to prevent the scale, skew,
        // or rotation values from being made relative to the target
        // object's original transform.
        // __motion_digitB1_mc.overrideTargetTransform();
        // The following calls to addPropertyArray assign data values
        // for each tweened property. There is one value in the Array
        // for every frame in the tween, or fewer if the last value
        // remains the same for the rest of the frames.
        __motion_digitB1_mc.addPropertyArray("x", [0,7.4116,14.0277,19.6419,23.9742,26.6463,27.1809,25.0619,19.91,11.7411,1]);
        __motion_digitB1_mc.addPropertyArray("y", [0,-14.8969,-30.1606,-45.8179,-61.8789,-78.2953,-94.9161,-111.395,-127.195,-141.658,-154. 35]);
        __motion_digitB1_mc.addPropertyArray("scaleX", [1.000000]);
        __motion_digitB1_mc.addPropertyArray("scaleY", [1.000000]);
        __motion_digitB1_mc.addPropertyArray("skewX", [0]);
        __motion_digitB1_mc.addPropertyArray("skewY", [0]);
        __motion_digitB1_mc.addPropertyArray("rotationConcat", [0,36,72,108,144,180,216,252,288,324,360]);
        __motion_digitB1_mc.addPropertyArray("blendMode", ["normal"]);
        __motion_digitB1_mc.addPropertyArray("cacheAsBitmap", [false]);
        // Create an AnimatorFactory instance, which will manage
        // targets for its corresponding Motion.
        var __animFactory_digitB1_mc:AnimatorFactory = new AnimatorFactory(__motion_digitB1_mc);
        __animFactory_digitB1_mc.transformationPoint = new Point(0.500000, 0.500000);
        // Call the addTarget function on the AnimatorFactory
        // instance to target a DisplayObject with this Motion.
        // The second parameter is the number of times the animation
        // will play - the default value of 0 means it will loop.
        // __animFactory_digitB1_mc.addTarget(<instance name goes here>, 0);
    But when I called this function it did nothing at all except increase my swf file size from 3.8 kb to 27.3 kb.
    Can anyone suggest a solution that would allow me to swap back and forth between two motions for an object.
    Thanks,

    The culprit is most likely the garbage collector. If you do
    not have any references to your tween object, it will eventually be
    destroyed by the garbage collector.
    From
    Adobe
    Flash Quick Start
    quote:
    Note: Consider variable scope when using the Tween class. If
    a tween is created in a function, it is important that the
    variable's scope exists beyond the function itself. If a tween is
    stored to a variable of local scope, ActionScript garbage
    collection removes the tween as the function completes, which will
    likely be before the tween has even begun.

  • Publishing a flash with AS3.0 on website does not work

    Okay, I'm finally at the end of my flash card. Here's the whole code.
    //import classes
    import com.greensock.TweenLite;
    import com.greensock.easing.*;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    //end of importing
    //start of sound section is for sound
    var cssLoader:URLLoader;
    var css:StyleSheet;
    var soundReq:URLRequest=new URLRequest("audioFiles/PaukenBrumfiel_AngelsOnHigh.mp3");
    var sound:Sound = new Sound();
    sound.load(soundReq);
    sound.addEventListener(Event.COMPLETE, onComplete);
    //end of sound section
    //Loading external texts
    var weiss:Font = new Weiss();
    var weissBold:Font = new WeissBolder18();
    var weissBolder:Font = new WeissBolder();
    var slideXTween:Tween;
    var txtAlphaTween:Tween;
    var txtNextText:Tween;
    var txtContainer:Sprite;
    var txtField:TextField = new TextField();
    var myTxtField:TextField = new TextField();
    var txtFldwebImages:TextField = new TextField();
    var textRequest:URLRequest=new URLRequest("happyHoliday.txt");
    var textLoad:URLLoader = new URLLoader();
    var txtFormat:TextFormat = new TextFormat();
    var myLinkFormat:TextFormat = new TextFormat();
    var strLink:String;
    var numXPos:Number;
    var numYPos:Number;
    //end of loading external texts
    function onComplete(event:Event):void {
        sound.play();
    function textReady(event:Event):void {
        //txtFormat.font= weiss.fontName;
        txtFormat.color=0x000066;
        txtFormat.size=24;
        //txtField.x = stage.stageWidth;
        //txtField.width = 800;
        txtField.autoSize=TextFieldAutoSize.LEFT;
        //txtField.height = txtField.autoSize
        txtField.wordWrap=false;
        txtField.text=event.target.data;
        txtField.setTextFormat(txtFormat);
        //txtField.y = 350;
        txtField.embedFonts=true;
    textLoad.load(textRequest);
    txtFormat.font= weiss.fontName;
    textLoad.addEventListener(Event.COMPLETE, textReady);
    txtField.x=stage.stageWidth;
    addChild(txtField);
    txtField.y=350;
    TweenLite.to(txtField, 40, {x:-stage.stageWidth*2.25, ease:Linear.easeNone, delay:0.5, onComplete:Inspiration});
    function Inspiration():void {
        txtFormat.font= weissBolder.fontName;
        textLoad.load(new URLRequest("inspiration.txt"));
        txtField.x=130;
        txtField.y=330;
        txtField.alpha=0;
        TweenLite.to(txtField, 5, {alpha:1, onComplete:GoogleFunc});
    function GoogleFunc():void {
        //create and initialize css
        addChild(myTxtField);
        strLink = "<a href='http://www.google.com/' target='_blank'>Google</a>";
        numXPos = 180;
        numYPos = 370;
        var myCSS:StyleSheet = new StyleSheet();
        myCSS.setStyle("a:link", {color:'#000066',textDecoration:'none'});
        myCSS.setStyle("a:hover", {color:'#FF6600',textDecoration:'underline'});
        txtFormat.font = weissBold.fontName;
        //txtFormat.color=0x000066;
        txtFormat.size=20;
        //txtFormat.bold = true;
        myTxtField.setTextFormat(txtFormat);
        myTxtField.defaultTextFormat=txtFormat;
        myTxtField.styleSheet = myCSS; // Linking CSS to TextField
        myTxtField.htmlText="";
        myTxtField.htmlText=strLink;
        myTxtField.wordWrap=false;
        //myTxtField.embedFonts = true;
        myTxtField.width = strLink.length*2;
        myTxtField.x=numXPos;
        myTxtField.y=numYPos;
        //trace("Third txtField.y: " + txtField.y);
        myTxtField.alpha=0;
        TweenLite.to(myTxtField, 1, {alpha:1, onComplete:webImages});
        //trace("tween done");
    function webImages():void {
        addChild(txtFldwebImages);
        var myCSS:StyleSheet = new StyleSheet();
        myCSS.setStyle("a:link", {fontsize:'20',color:'#000066',textDecoration:'none'});
        myCSS.setStyle("a:hover", {fontsize:'20',color:'#FF6600',textDecoration:'underline'});
        txtFormat.font = weissBold.fontName;
        //txtFormat.color=0x000066;
        txtFormat.size=20;
        //txtFormat.bold = true;
        txtFldwebImages.setTextFormat(txtFormat);
        txtFldwebImages.defaultTextFormat=txtFormat;
        txtFldwebImages.styleSheet = myCSS; // Linking CSS to TextField
        txtFldwebImages.htmlText = "";
        txtFldwebImages.htmlText="<a href='http://www.google.com/webImages/' target='_blank'>Google Images</a>";
        txtFldwebImages.wordWrap=false;
        //myTxtField.embedFonts = true;
        txtFldwebImages.width = 300;
        txtFldwebImages.x=300;
        txtFldwebImages.y=370;
        txtFldwebImages.alpha=0;
        TweenLite.to(txtFldwebImages, 1, {alpha:1});
    //end of loading external texts
    Okay, the problem is when I publish the .swf files and put it in an html or .aspx page, it does not work. The audio is not there and a few others things ar enot working. However, it does work if I click on the.html file that Flash created during the publication.
    Here are the folder structions:
    www.mysite.com/myFlashPage.aspx
    www.mysite.com/flashFileFolder/
    www.mysite.com/flashFileFolder/audioFiles/
    So, the myFlashPage.aspx containsthe myFlash.swf file that is inside the flashFileFolder. For some reason, it does not work. Any suggestion is much appreciated.

    The .html file does work if I publish it into the same folder as I created the Flash project. However, when I publish the
    flash .swf to my web site folder (mapped), it's no longer working. The mapped web site drive structher are as follows:
    D:\Mysite\ contains the .html file
    D:\Mysite\flashFileFolder\ contains the .swf file
    D:\Mysite\flashFileFolder\audioFiles contains the PaukenBrumfiel_AngelsOnHigh.mp3 file
    D:\Mysite\flashFileFolder\greensock-tweening-platform-as3 contains all the tweenlite files
    The .html file does not work either. What else do I need to change?

Maybe you are looking for

  • HP Deskjet 6540 drivers for Windows 7

    We have recently upgraded from XP to Windows 7.  We have followed all of the instructions on disconnecting and reconnecting the usb cables and trying to let Windows 7 detect and install the drivers but no success.  We tried installing the Windows upd

  • Trackpad jumpy. Not able to use MacBook.  Has anyone heard from Apple on this pervasive issue?

    My late 2008 13" MacBook (Snow Leopard) has become so erratic that it is almost impossible to use.  (Using another MacBook now). Hard to believe it is not an OS or update issue since it appears to be very pervasive.  Anyone heard from Apple?? Any fix

  • How to display names in textfield using ajax+flex

    HI, i want to display some names in a textfield like type forward that is if the user enter " a " in the textfield, the names starting with " a" has to display in drop-down list. how we can do this in flex?. please help me it is very critical for me.

  • Migration Assistant not working with OS X Lion via Wireless Network?

    Anybody know how to assist me here? Basically, I have two iMacs on seperate floors of my home.  They are newer models (both purchased last year) and I have upgraded both of them to Lion and just ran a system update on both of them to ensure they are

  • HT4623 i am unable to restore my iPhone

    I am using my phone in india with airtel network connection but suddenlly the signal of my phone went into searching mode and keep on searching for the signal but its not getting so i connected it to itunes and clicked on restore but it went into res