a question on a resizable loaded object

Guys...

I was searching on the website on how to make an auto Resizable screen, so it feet on many devices regardless of their size and I found a tutorial that adds the image to the Flash library and it resizes according to the size of the screen...

Now, I have removed the object from the library and changed the var "bitmap" of the tutorial for a "Loader", so the image is not in the library...

My only problem is that when you try the swf, the image is all over the screen and fits on it after enlarge you or reduce the size of its...

Then, how the image can be in the right place at first?

(The tutorial had as an event trigger a mouse click... I changed it to a timer event and at my peak was in the library it worked fine, but now I have to resize the windows so that it works)

Here is the code:

Main class

package {}

Import org.display.OffsetResize;

import flash.display.Sprite;

Import 12345678910111213import;

import flash.display.StageAlign;

import flash.display.StageScaleMode;

import flash.events.Event;

import flash.events.MouseEvent;

import flash.utils.Timer;

import flash.events.TimerEvent;

import flash.display.Loader;

import flash.net.URLRequest;

SerializableAttribute public class Main extends Sprite {}

private var _bg:OffsetResize;

private var t:Timer = new Timer (0,0);

public void Main (): void {}

If (internship) init();

of another addEventListener (Event.ADDED_TO_STAGE, init);

}

private void init(e:Event=null):void {}

stage.scaleMode = StageScaleMode.NO_SCALE;

internship. Align = StageAlign.TOP_LEFT;

var photo: Loader = new Loader();

Picture.Load (new URLRequest ("FIN1.jpg"));

_bg = new OffsetResize (picture, OffsetResize.MIN);

stage.addChildAt(_bg,0);

_bg.stage.align = StageAlign.TOP_LEFT;

t.addEventListener (TimerEvent.TIMER, resizeada);

t.Start ();

}

private void resizeada (TimerEvent): void {}

_bg.offsetType = _bg.offsetType is OffsetResize.Max? OffsetResize.MIN:OffsetResize.MAX;

t.Stop ();

}

}

}

Class OffsetResize

package org.display {}

import flash.display.Sprite;

import flash.display.DisplayObject;

import flash.events.Event;

SerializableAttribute public class OffsetResize extends Sprite {}

public static const MAX: String = "max."

public static const = "min" MIN:String

private var _offsetType:String;

public void OffsetResize($child:DisplayObject,$offsetType:String="max"):void {}

_offsetType = $offsetType;

addChild ($child);

If (internship) init();

of another addEventListener (Event.ADDED_TO_STAGE, init);

addEventListener (Event.REMOVED_FROM_STAGE, end);

}

private void init(e:Event=null):void {}

stage.addEventListener (Event.RESIZE, stageResize);

stageResize();

}

private void stageResize(e:Event=null):void {}

var px:Number = stage.stageWidth / width;

var py:Number = stage.stageHeight / height;

var div:Number = _offsetType == 'max '? Math.Max(PX,PY):Math.min (PX, PY);

Width * = div;

height * = div;

x=(stage.stageWidth/2)-(width/2);

y=(stage.stageHeight/2)-(height/2);

}

private void end(e:Event):void {}

stage.removeEventListener (Event.RESIZE, stageResize);

}

public function set {offsetType(type:String):void}

_offsetType = type;

If (stage) stageResize();

}

public function get offsetType (): String {return _offsetType ;}

}

}

Thanks in advance!

Try:

Main class

package {}

Import org.display.OffsetResize;

import flash.display.Sprite;

Import 12345678910111213import;

import flash.display.StageAlign;

import flash.display.StageScaleMode;

import flash.events.Event;

import flash.events.MouseEvent;

import flash.utils.Timer;

import flash.events.TimerEvent;

import flash.display.Loader;

import flash.net.URLRequest;

SerializableAttribute public class Main extends Sprite {}

private var _bg:OffsetResize;

public void Main (): void {}

If (internship) init();

of another addEventListener (Event.ADDED_TO_STAGE, init);

}

private void init(e:Event=null):void {}

stage.scaleMode = StageScaleMode.NO_SCALE;

internship. Align = StageAlign.TOP_LEFT;

var photo: Loader = new Loader();

picture.contentLoaderInfo.addEventListener (Event.COMPLETE, resizeada);

Picture.Load (new URLRequest ("FIN1.jpg"));

}

private void resizeada(e:Event):void {}

_bg = new OffsetResize (picture, OffsetResize.MIN);

stage.addChildAt(_bg,0);

_bg.stage.align = StageAlign.TOP_LEFT;

_bg.offsetType = _bg.offsetType is OffsetResize.Max? OffsetResize.MIN:Offs etResize.MAX;

}

}

}

Tags: Adobe Animate

Similar Questions

  • Microsoft Picture It 7.0 "failed to load object, please run set up.

    I have Microsoft Picture It 7.0.  I can't open it all a sudden.  Don't know what has changed.  I got suddenly "failed to load object, please run set up" when I try to open it.  I saw a question/post from joel January 3, 2011, but I can't do what is suggested in this answer.  Please help me solve this problem.

    Hello

    I suggest to try to uninstall and reinstall the application and check to see if it helps:

    http://support.Microsoft.com/kb/307895

    It will be useful.

  • How to resize an object and show on stage

    Im trying to resize a simple object according to what dimensions I set, but it does not work.

    so now the stageHeight and width is 600 x 600 and it still does not work.

    And how do I resize the object immediately when the SFW load (so early, it will be 3 times bigger)

    I have a MainClass with this code

                            public var  rescaleRatio:Number = 1;
                        public var _element1:CreateRow_Col
    
                        public function MainClass_Test() {
                        addEventListener(Event.ADDED, init);
                        _element1 = new CreateRow_Col(rescaleRatio)
                        addChild(_element1)
                        }
    
                        public function init(e:Event):void{
                                   stage.scaleMode = StageScaleMode.NO_SCALE;
                                     stage.align = StageAlign.TOP_LEFT;
                                     stage.addEventListener(Event.RESIZE, setUpScreen);
                        }
    
    
                        public function setUpScreen(ev:Event):void{
                                  stage.removeEventListener(Event.RESIZE, setUpScreen);
                                  if(stage.stageHeight > 500){  
                                            rescaleRatio = 3;  
                                  }else 
                                            rescaleRatio = 5;  
    
                        }
    
    

    and the CreateRow_Col class has this

    public class CreateRow_Col extends Sprite {
    
                        public var theAppliedScale:Number;
                        public var myObject:BG = new BG()
    
                        public function CreateRow_Col(reScalling:Number) {
                                  theAppliedScale = reScalling;
                                  addEventListener(Event.ADDED_TO_STAGE, zzz);
                        }
    
    
                        private function zzz(e:Event):void {
                                  removeEventListener(Event.ADDED_TO_STAGE, zzz);
                                  myObject.scaleX = myObject.scaleY = theAppliedScale
                                  addChild(myObject)
                        }
    

    Copy the following code and paste it into your document class:

    package {}

    import flash.display.MovieClip;

    import flash.events.Event;

    SerializableAttribute public class MainClass_Test extends MovieClip {}

                            public var  rescaleRatio:Number = 1;
                        public var _element1:CreateRow_Col

    public function MainClass_Test() {
                        addEventListener(Event.ADDED, init);
                     
                        }

    public function init(e:Event):void{
                                   stage.scaleMode = StageScaleMode.NO_SCALE;
                                     stage.align = StageAlign.TOP_LEFT;
                                     stage.addEventListener(Event.RESIZE, setUpScreen);
    setUpScreen(null);
                         }

    public function setUpScreen(ev:Event):void{
                                  if(stage.stageHeight > 500){ 
                                            rescaleRatio = 3; 
                                  }else
                                            rescaleRatio = 5;

    }

     if(!_element1){ _element1 = new CreateRow_Col(rescaleRatio);                    addChild(_element1)} else {_element1.zzz(null);  //<-make zzz() public in your other class.}
    

    }

    }

    }

  • Error determining responsible for image size: the loading object is not sufficiently loaded to provide this information.

    Hello

    I am trying to load and image and determine its dimension immediately after loading.  I use a Loader object and check the width when the object of the loader's contentLoaderInfo Event.COMPLETE event is triggered...

    myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, onLoadComplete);

    Then:

    public void onLoadComplete(event:Event)

    {

    trace (myLoader.Width); 0

    trace (myLoader.contentLoaderInfo.Width); Error: The loading object is not sufficiently loaded to provide this information.

    }

    I tried something similar with the event of Event.INIT but same result.  Any ideas on the best way to solve this problem?

    Thank you!

    Moshe

    I think it's the answer to your question:

    trace(event.currentTarget.width);
    
  • I can't resize any object inside a tab control and control of the tab itself

    Hi all

    Since this morning I noticed that I can't always resize the object placed inside a tab control or the control tab itself.

    I have a few objects (controls, indicators, etc.) outside of the tab control, and they are resizable (I can see the dark blue squares and I am able to adjust the object); Instead, any object inside the tab control is still not resizable (when I select the dark blue boxes are not visible and I can't access the properties of the object by clicking with the right button of the mouse over it). If I have access to the properties of the object to the block diagram, the appearance of her-> frame size is gray and I can't change the size fields.

    It seems that something was changed when I try to adjust the minimum window size and appearance of windows in the proposals of VI, but I restore the previous values...

    How can I solve this problem?

    Sure, tab control is not locked.

    If the tab control is locked that resize is not possible

    Lucast85 wrote:

    Hi all

    Since this morning I noticed that I can't always resize the object placed inside a tab control or the control tab itself.

    I have a few objects (controls, indicators, etc.) outside of the tab control, and they are resizable (I can see the dark blue squares and I am able to adjust the object); Instead, any object inside the tab control is still not resizable (when I select the dark blue boxes are not visible and I can't access the properties of the object by clicking with the right button of the mouse over it). If I have access to the properties of the object to the block diagram, the appearance of her-> frame size is gray and I can't change the size fields.

    It seems that something was changed when I try to adjust the minimum window size and appearance of windows in the proposals of VI, but I restore the previous values...

    How can I solve this problem?

  • Resize an object: ALT + CMD + SHIFT does more work in CC15 mac?

    Hello

    Before, in CC14, when I wanted to resize an object or a group of objects by keeping its proportions, I simply used the keys CMD + ALT + SHIFT while I resize the object with one of their corner. (with my mouse)...

    Now, I've just updated to CC15 and this function no longer works?

    I have to configure something in preferences to retrieve this basic function?

    Thx for your help! I lose a lot of time without this basic function...

    It is almost always caused by third-party software that you are running. A common problem are extensions of browser that are striking strikes. Restart your computer and run InDesign before any other program, and it will probably work fine.

    If it does not create a new user on your computer and run InDesign from the new user.

  • Opens a file someone else you want to resize an object, it is larger that the artboard, how can I get rid of the artboard

    Opens a file someone else you want to resize an object, it is larger that the artboard, how can I get rid of the artboard

    Marvin,

    You can view > hide the work plan, but why not just put to adapt to what you want?

    You can do this in the file > format Document, or with the tool of workplan according to version.

  • Positioned on a Macbook Pro, the handles to resize the objects are missing?

    Positioned on a Macbook Pro, the handles to resize the objects are missing?

    With the move tool selected, you have to display controls to turn checked in the options toolbar?

  • How to resize the object + text lighting

    Hello

    1 lately, I can't resize an object.

    The surrounding border of the object is with filled rectanglers and

    not with rectangler hollow. So, I can't resize objects - how can I solve this problem?

    2. when I try to mark the text, there score perfectly but I do not see the location eventhough I choose what he.

    How can I mark the text and display the marked text (marked selected text)

    Kind regards

    Koko Fiko

    Koko Fiko,

    You can open the view drop-down list and check out the edges and Bounding Box (both must hide, indicating the possible action, implying that are displayed).

    According the description I'm not sure who can apply.

  • Dynamically add child loader objects

    Hi I want to add the loader object dynamically on stage, but indicating an error.

    function addImage(str:String) {}

    LD = new Loader()

    LD. Load (new URLRequest (str + '.png'))

    ld.contentLoaderInfo.addEventListener (Event.COMPLETE, loadfinish)

    }

    function loadfinish(event:Event):void {}

    addChild (event.target.data)< < < this is showing the error

    }

    error is:

    ReferenceError: Error #1069: property not found on flash.display.LoaderInfo data and there is no default value.

    at imagesearch_fla::MainTimeline/loadfinish()

    If you are looking for the Loader class in the help documentation you will see that the ois of error what is the problem.  There is no property 'data' for the Loader class.  The Loader class, since it deals mainly with the Visual elements, has a property 'content '.

    The URLLoader class has a data property, and this is mainly because the URLLoader class is used for data files.

  • Resize the object inside the tab control

    Hello

    I have problems with the design of a user interface. I need to have multiple controls resize with panel inside a tab control.

    I see it right, there is no way to have a resize done inside a tab with decorations control that separates controls?

    I have not yet checked LabVIEW 2013.

    I have attached a vi in LV2012 as an example.

    Thanks in advance.

    Yes it is a feature I've wanted also over the years.  Here's the first result that I got from the exchange of idea, but I think that there are duplicates autour.

    http://forums.NI.com/T5/LabVIEW-idea-exchange/ability-to-fit-scale-object-within-tab-control-page/ID...

    Basically, you can't do nativly but you can trick it work for you.  You make a tab that is false the user interacts with, changes to the value of another tab that things in it and then you fix every thing you want it is in the tab where it is demonstrated.  This works well if the thing in your tab is an element able to evolve to adapt to it, but if in a tab, you have a chart and another you have a bunch of buttons that should not change, then you will get a strange behavior.  You can tell the chart is more scope to this component, but then you lose the 'ladder while resizing objects' that make a lot more native user interface research.

  • Best practical Question - update the query (see object) based on the drop-down list selection

    I have a question about the most efficient way to perform the following task:

    I create a page that contains several DVT components to display data based on specific requests.  Top of page I am hoping to have a drop down menu (selectOneChoice) that contains dates different and based on what the user selects (i.e. 2010, 2011, 2012, 2013, etc.), this will update the query in the view object of some (i.s. WHERE Date = '2011', or WHERE Date = 2013"), and then you view the appropriate data in the DVT.  What is the best way to do this - from a point of view bean managed / page, as well as the View object?  Advice/documentation would be appreciated.

    Thank you!

    When you drag the vo executeWithParams one another that will create links for operations such as 'executeWithParams2', 'executeWithParams3 '. On the method that you use to update a view by calling the executeWithParams operation, you call the other operations too.

    Timo

  • Question of the multi-state object

    Hello again,

    I would like to have the text window appear only on the click of a button.

    What I have to use a tip for this action or can I simply use a multistate object that I switch?

    If so, how to create an invisible State standard for only the second State as the visible box/picture I want to show?

    Am I missing something?

    Thanks for any help!

    I have to leave now for a meeting, will be back in a few hours.

    You can post a screenshot of the status display? And I would prefer to use ' change the State of... "to be very precise. Did you really follow the workflow, I explained to him? I always double check before answering a question.

    Here are some reading, I used multistates:

    1 share = 5 buttons toggle - Captivate blog

  • How to resize an object and also to mitigate the effects (transparencySettings)?

    I want to to scale an object through script but also effects nationwide, currently my resizing does not only. My effects are TransparencySetting: drop shadow, inner glow, outer glow.

    For example using the following does not work:

    pdf.resize(CoordinateSpaces.innerCoordinates, AnchorPoint.topLeftAnchor, ResizeMethods.multiplyingCurrentDimensionsBy, [pointSizeScale, pointSizeScale]);
    
    

    I have to resize the effects that I have at hand for example:

    thisObj.transparencySettings.dropShadowSettings.xOffset = dSXYOffset*pointSizeScale;
    thisObj.transparencySettings.dropShadowSettings.yOffset = dSXYOffset*pointSizeScale;
    thisObj.transparencySettings.dropShadowSettings.size = dsSize*pointSizeScale;
    

    Thanks in advance!

    I think that by using a transformation matrix will solve your problem (pdf.transform (.))

  • Question about the lazy loading the cache

    Hello

    First turn off please forgive my ignorance, this if my first time with a database that is put in cache.

    I'm trying to set up SQLFire so that it will be a cover for a traditional back-end RDBMS (p.6 that is applied on the RDBMS which will appear in the SQLFire cache).

    In the vFabric SQLFire user, Chapter 22 'Cache SQLFire strategies' Guide mentions that this can be done through deferred data loading into the cache. I do not understand completely how to set this up and I don't see any other details in the User Guide or anywhere else.

    Anyone would be able to point me to a more detailed explanation of lazy loading the cache (or be able to explain more)?

    Thank you.

    Hi, there are some problems with having obtained documentation out of sync from the GA version. Also based on your question, that I passed by this yesterday and hit a few challenges, so I wrote a blog post that shows how to use SQLFire for the caching of end to end. I hope it will be useful to you.

Maybe you are looking for

  • How can I change the home page that appears when I open Firefox?

    I just had to reinstall a program that was damaged, and somehow the process changed my Firefox home page. Not only is the new not what I want, when I try to open Firefox I get a notification of WOT that the new page is dangerous. I'm a Firefox window

  • 2450 is partitioned. No access to start linux on startup

    I partitioned the laptop with an extended drive and the logical drives thanks to Paragon Partition Manager and Boot Manager. However when I start it up, the Partitions do not show. They show only once I'm inside Windows. Everything is what shows the

  • El Capitan want allow me to move to the trash

    I had the Apple store install an SSD on my iMac.  Since then I can't move anything (from anywhere) to the trash.  I get a pop-up warning me it is permanent, and it does not move it to the trash.  He's telling the truth.  I know about the "option/file

  • Rocket will not keep time.

    Hello. When I set the time on the "rocket" (4g, v2, 2.03.33a firmware), it stops time tracking when it is off. Is there a separate battery which does not, as a clock battery internal? Thanks in advance. Hope everyone is having a great day. (I did a s

  • I can not send attachments in my email when I want to send an email that he will not seek _ atttachment

    Vista Windows transfer an email with an attachment when I passed, it does not show the atttachmennt and half the time I can not yet send when I empty a new email Ther must be something that I do not habve to market, but I can't see it.