Determine the width of the loaded clip

Hi all
Is there a way I can get and set the width and height of a loaded clip? I created a movie then loaded and empty empty a small swf file in the film with loadClip. I now want to determine the width and height of the loaded clip and it adapts to the size of my movie dimensions. Is this possible? Although the film load fine and I can position its x and y coordinates, the width and height show as zero.

Can someone help me with this one? I use Flash Professional 8.

Thank you
Brayne

You must wait until loading is completed to access the loaded SWF _width and _height. and then you'll see the _width and _height of objects on stage in the first image if you access these properties as soon as the SWF is initialized.

Tags: Adobe Animate

Similar Questions

  • AS3: How to target sub-MC of the loaded clip?

    Hey everybody. I am new to AS3 and very... very lost (the last time I did a lot with flash was Flash 5).

    Short version: I am trying to load external .swf from a URL and add event handlers for the video clips (or his film clips sub - MCs) on its stage. I can't find SOMETHING online about how to do it.

    Details:

    I have been instructed by my employer to build a control interface simple in flash with just a few buttons to make things like display some info or pictures or maybe a MP3 player. I wrote small test apps to do all of these individual things and managed to fake my way through.

    But the sticking point, is now trying to put all the user interface controls in an external .swf, which I then load into the canvas by a URL. The goal is to be able to load it into a variable named, say, "private _ui:MovieClip" and then add event handlers to programme clips in this name as:

    _ui.someButton1.addEventListener (MouseEvent.MOUSE_UP, handlerFunction1);
    _ui.controlStrip.someButton2.addEventListener (MouseEvent.MOUSE_UP, handlerFunction2);

    The goal is that if we want to Exchange on the user interface for a particular client, we just export a new .swf with all instances of correctly named MC & use the new URL to load the user interface.

    I seem to be able to load the .swf OK and trace the film clips "Chronology of the hand" as follows:

    _ui2.contentLoaderInfo.addEventListener (Event.COMPLETE, uiDidLoad);
    function uiDidLoad(evt:Event) {}
    trace ("UI2 LOAD");
    {if (_ui2. Content)}
    addChild (_ui2);
    trace (_ui2. Content); -> [object MovieClip]
    Target the "ControlStrip" named instance on the main timeline of the loaded .swf
    trace (_ui2. Content.controlStrip); -> ERROR
    }
    }

    Can someone point me in the right direction here? I spent hours don't make any progress on it. I think I've read half of the website of adobe so far. :-(

    -Cliff

    Quote:
    Posted by: kglad
    You must then mount this object like a MovieClip or the flash compiler is concerned.

    I discovered this yesterday after a * lot * of trial and error. Everything seems to work correctly when you use:

    LDR. Content as MovieClip;

    I'm a little surprised that has not documented a little clear, but I guess it could be something that is obvious, if you ALSO know well enough. I'm trying to learn as much as I can because I go but you do not have my calendar does not really some time a lot of time for learning from the ground up.

    Thank you.

  • the loading time of the mc control

    I'm creating a game that will take care of mangoes with numbers on it... i'm using numbers 08:51

    I want to set the time of each mango to load... for example: mango #2 load every second of 48 and 15 at the time, mango 5 load every second 38th, 15th, 3rd time left... How do I code?

    I have a code that loads the mangoes in random x position... but when the caught character mango, it still does not load...

    Here is a jpg of what I'm doing...

    khigh game5 - page1.jpg

    This is the code I use: this code is attached to the mango-(2)

    onClipEvent (load) {}

    If (_root.time == 50) {-> I tried to put an if statementto determine the loading time but does not work}

    function reset() {}

    This._x = Random (550);

    This ._y =-250;

    _root. SPEEDB =-5;

    }

    Reset();

    //}

    }

    onClipEvent (enterFrame) {}

    If (_root.time == 50) {-> I also tried to put here but does not work too...}

    This ._y = _root.speedb;

    If {(FLF > 380)

    Reset();

    }

    If (_root.mango_mc.inMango_mc.hitTest (_root.caloy_LR.caloy_Right.inBaske t_mc) |)  _root.mango_mc.inMango_mc. HitTest (mc _root.caloy_LR.caloy_Left.inBasket_).  _root.mango_mc.inMango_mc. HitTest (mc _root.caloy_LR.caloy_stop.inBasket_)) {}

    _parent.mango_mc.gotoAndPlay (2);

    _root. Score-= 2;

    }

    //}

    }

    I hope you guys could help... Thank you!

    Here's how to create two mangoes, mango12 and mango 13:

    var tl:MovieClip =;
    var dep:Number = 0;
    tl.attachMovie ("mango12", "mango_" + dep, dep ++);

    tl.attachMovie ("mango13", "mango_" + dep, dep ++);

    var mangoI12 = setInterval(mangoF12,30000);     If I remember this, all the mangoes will load every 30 seconds? -No, only mango12

    var mangoI13 = setInterval(mangoF13,45000);     mango13 is created every 45 seconds

    function mangoF12() {}
    tl.attachMovie ("mango12", "mango_" + dep, dep ++);
    }

    function mangoF13() {}

    tl.attachMovie ("mango13", "mango_" + dep, dep ++);

    }

  • New film clip to the exact position of the load

    I'm new to Flash, but not to programming, but took an example of the documentation, but it doesn't seem to work...

    Create a clip relative to a container
    this.createEmptyMovieClip ("logo_mc", this.getNextHighestDepth ());
    creates a child clip inside 'mc_1 '.
    This is the clip that will replace the image
    logo_mc.createEmptyMovieClip("container_mc",0);
    logo_mc.container_mc.loadMovie (" http://www.macromedia.com/images/shared/product_boxes/80x92/studio_flashpro.jpg");
    _root. DY = stage.height + 4
    _root. DX = stage.width + 4

    The last two lines will actually place the new clip of X and postions are determined between + 4 and + 4 stage.width stage.height?

    I tried several variations - even plugged in numbers as root. DY = 200; and the root. DX = 200; but still loads in the same position every time...

    I'm misunderstanding this? or is there a better way to do it?

    Thank you!

    Tim

    Craig and Kglad,

    Thanks for your comments! This works! I did not yet notice the case so...

    Thank you very much!

    Tim

  • How to determine the total number of images in the external .swf file loaded

    I have to be able to load both external .swf files and make them play in order. To do this, I need to know the number of images in the first .swf file so I can check _currentframe against _totalframes to determine when he is finished playing so that I can load another.

    Most of the stuff I see indicate that _totalframes on an external .swf can be determined by loading the .swf in a container clip and then check using a listener in the .onLoadInit. Like this:

    ------------------------------------------------------------------------------------------ ----------------------------

    this.createEmptyMovieClip ("tester_mc", 1);
    var mcListener:Object = new Object();

    mcListener.onLoadInit = {function (target_mc:MovieClip)}
    target_mc.onEnterFrame = function() {}
    If (this ._currentframe > = this ._totalframes) {}
    trace ("total frames =" + this ._totalframes);
    delete this.onEnterFrame;
    } else {}
    trace (target_mc._currentframe + "OF" + target_mc._totalframes);
    }
    }
    }

    var test_mc:MovieClipLoader = new MovieClipLoader();
    test_mc. AddListener (mcListener);
    test_mc.loadClip ("Ad_Group.swf", tester_mc);

    ------------------------------------------------------------------------------------------ -------------------------------------

    Unfortunately, this doesn't seem to work. The trace will always return a total number of frames of 1.

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I would appreciate any ideas on how to raise the total number of frames of an external .swf file or, Alternatively, put it another way when it's done playing. (Not only the loading, but play until the end.)

    TIA,

    C

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I wouldn't imagine. My guess is that the main scenario for the external swf file has only 1 frame and the rest of the animation is inside a movieclip in this timeline. You publish this swf? Can you open the FLA and check how many images is open on the main timeline?

    The approach that you have mentioned is about what there is. But he knows check a chronology. If there are many nested movieclips, it may be impossible to understand what timeline you really want to be 'THE' full chronology.

    If you have the FLA, you can have the video call function on the _root timeline which tells the main swf that has completed a movieclip or something like that.

    Also, I have in my head somewhere that I recently saw something that someone made similar to this one, but do not remember... If it appears in my head that I will post.

  • 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);
    
  • How can I determine the width of a menu bar

    Several years ago, I had suggested a CVI function to determine the width of a bar menu (in pixels), so that the minimum width of a panel could be calculated more easily - now for the new year I would like to repeat this wish as it seems that this possibility is still missing...

    Best wishes for 2009,

    Wolfgang

    Hi Wolfgang,.

    It's a good suggestion. I'm sorry that we have not acted on it so far. We'll add an attribute that will perform this task in the next version of the CVI.

    Thank you

    Luis

  • How can I determine the type of image to be used before loading an image?

    I'm developing an application using VB 2005 which measures two 8-bit or 16-bit image files. When I saw the picture, I find that I have to set the type of image the image buffer before playback of the image in it. For example, if I read a 16-bit image in a buffer of 8 bits, the image is truncated. I guess I could read the image in a 16-bit buffer and retype it if the pixel values are less than 255.

    Is there a better way to do it? Can I determine the number of bits of an image before loading in a buffer?

    Thank you!

    Hi Steverino,

    Olivia is incorrect... VDM has a function called GetFileInfo which does just what you want. It only reads the header of the image but does not load the entire image in memory. It will give you various properties such as the bit depth.

    I think that on the new .NET support, there can exist here: NationalInstruments.Vision.Analysis.Algorithms.GetFileInformation.

    Thanks to the ICB and our legacy of .NET support, it's probably a similar name.

    Eric

  • I signed up for photography CC, loaded on laptop main, when installing on my ASUS Transformer to only LR5.7 not CRD.  Determine the latest version that a device can run install?

    I signed up for photography CC, loaded on laptop main, when installing on my ASUS Transformer to only LR5.7 not CRD.  Determine the latest version that a device can run install?

    Yes.

  • Determine the Total number of images in a loaded SWF file

    I used the loader class and the load method to load a swf file that has multiple frames.  Does anyone have a suggestion how to determine the total number of frames in the SWF file script after loading?

    AFTER loading is complete (that is to say, use a listener), you can access the content property of the loader (cast as a movielcip):

    MovieClip (yourloader.content) .totalFrames;

  • shell script to determine the width of the file, size, resolution cs5 js

    I use a Script of Michael L Hale (core.quickMetadata "that uses" xmp.getProperty "and the bridge") to determine the size and the resolution of files without having to open or place.

    Unfortunately, it fails with some files (non-Photoshop generated bitmaps, seems).

    (PDF, I treat differently altogether to avoid the problem determination pages pdf counties and potential problems with PDFs containing different size pages.)

    "None of you do not know if and how you can reach resolution with" app.system "in CS5, the height, the width of the files?

    I may have come across before, but is unable to locate such a thread currently.

    Thanks for any input.

    The following 2 options that you can use if you want to clear all information in text file then analyze js. You could see if one of these contain the data that you are after?

    #target bridge
    
    var foo = File('~/Desktop/SomeFile.tif');
    
    getAllXMLSIPS(foo);
    
    //getMetaDataMDLS(foo)
    
    function getAllXMLSIPS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "sips --getProperty allxml ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
    function getMetaDataMDLS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "/usr/bin/mdls ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
  • How can I get the width of a loaded swf scene?

    Is it possible to get the real of a loaded swf stageWidth?

    The problem comes when the loaded swf file has some items off the stage. In this case content.width becomes bigger then the scene.

    My code looks like this:

    var request: URLRequest = new URLRequest (file.url);

    var loader: Loader = new Loader();

    Loader.Load (request);

    loader.contentLoaderInfo.addEventListener (Event.INIT, CaseTailleAuto);

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, addImg);

    private void checkSize(e:Event) {}


    That's where I need to see the width of my loaded swf

    trace (e.Target.Content.Width);

    }

    private void addImg(e:Event) {}

    trace ("complete");

    }

    Thank you

    Andrei

    I don't think you can get the width of the stage of the loaded file, unless you assign it as a constant somewhere in the file.  The loaded file loses its stage when it is loaded into another swf

  • loading clips in loadmovienum... trying to load in the background

    I swear it was working before, but I must have changed something because now it is not. I have a few clips that im trying to carry the load in the background without being visible during the initial loading. To achieve this, I went with something like that on the first frame of the main clip:

    loadMovieNum("dl_illustration.swf",4);
    _level4._visible = false;


    I swear THAT this same code worked very well about 30 minutes ago and now Ive played with some other stuff and its doesn't work more the illustration clip just right charge on top of the main Clip, essentially without taking account of my call to make it invisible. Does anyone have AN idea what is happening here?

    You preload _level4, not _root:

    section 1:

    Fill._xscale = 0;

    loadMovieNum("dl_illustration.swf",4);

    {this.onEnterFrame = function ()}

    var lb:Number=_level4.getBytesLoaded();

    var tb:Number=_level4.getBytesTotal();

    {if(BL>0)}

    var loaded: number = 100 * bl/bt

    Fill._xscale = loading;  assuming that there is something on the stage with instance name of filling

    prcnt_done. Text = Loaded + "% Loaded"; assuming it is a textfield with instance name prcnt_done on stage

    {if(BL>=BT)}

    delete this.onEnterFrame

    has finished loading.  No matter what

    }

    }

    }

    p.s. the _visible property is reset in charge-targets may not be used to hide loading swf/images.  You can use the property _alpha because who is not reset in charge-targets.  but, even once, the target must exist before you can reference it.  your best solution, if you want to use _level4, is to place a blank Keyframe in your external swf in the frame 1 and attach a stop() to this framework.  Once the upload is complete, apply a play() method to _level4 when you want to play.

  • All webcam width/height and determine the connection type

    Hi, two quick questions:

    1. is there a way in ActionScript to determine what type of connection is used (e.g., P2P or FMS)?

    2. is there a way to set the width/height of the image of the webcam? I currently have to extend the WebcamPublisher class to access the instance of _camera and use the Camera.setMode () method, but it seems that that has no effect whatsoever.

    Thanks in advance,

    Michiel

    PS: I am aware of the captureWidthHeightFactor method, but I really do not like this approach, as it is not clear what dimensions are used for the video. I would like to determine the dimensions of myself, as when you use the Camera.setMode () method.

    For your share of width and height, you can use APIs of resolutionFactor in webcamPublisher as captureWidthHeight that API is deprecated. Height and the default width is multiplied.

    And again, if you want to set your own native height/width, since you already are subclassing WebcamPublisher, subclass just the createMyStream function and add your native width and height. See this function in the source code 9 WebcamPublisher player provided.

    One thing I forgot to mention in the last post, you have P2P with player 10 and you must use the Player 10 SWC for any verification of P2P. Player 9 will always be FMS.

    I hope this helps.

    Thank you

    Hironmay Basu

  • How to check the width of the loaded image

    Hi my script loads an image like this:

    image = new Sprite();

    imageLoader = new Loader;
    imageLoader.load (new URLRequest(imageList.image[1].imgURL));
    image.addChildAt (chargeurImage, 0);

    How can I check the width of the loaded image? track (image. Width) gives 0...

    Where is the process of full load? It is not complete at the time where the code that show you is running.

    When you load external content, it takes time to load.  Your code is not wait for that to happen, he keeps just treat each line independently of the load status.

Maybe you are looking for

  • Cluster support

    Hello Is there a way to take a group of control 6 and it unbundle then take these components and bundle 3 controls to form 2 groups of 3 indicators? In my class VI I, but I have to resize the cluster to "hide" the 3 items I want. Is there a more legi

  • How to control (or know) the speed of iteration of While loops?

    Hello world! Currently, I am implementing a 2 bit counter in LabVIEW. Fortunately, I was able to find examples on the forums of NOR. Yet, in real life, speed of the ILO 2 counters are controlled by a clock switching frequency to produce different out

  • Use two assistants for the acquisition of data at the same time

    Hello I want to read multiple data channels of analog inputs on my DAQ hardware. However, when I try to create two separate data acquisition assistants for each entry, it gives an error saying "is reserved for the specified resource. The operation co

  • Reader just used... Turn on

    Then. I was listening to just my Sansa e280, and while he was on break im in the middle of the song, I plugged it to my computer and it just... off.  whenever I hit the power button the screen remains always empty... uh... what I did?  does anyone kn

  • Recovery for my E6520 software?

    I had to replace my hard drive.  How can I get a BONE to re - install?