AS3 as slow as AS2?

ok, i've made a simple comparison test (due to a performance
issue i had with a more complex app). the app adds 10000 movieclips
to stage, each of them with a random color and random alpha. i've
done this in as2 and as3 (as2 compiled in flash authoring, as3
compiled with mxmlc). the result is kind of freaking me out ;)
AS2 build time: ca. 6s
AS3 build time ca. 1s
so far so good. but then, i resize the window so i can see
all the rects, then i just do nothing. nothing! i just leave the
window open:
AS2 cpu: 99%
AS3 cpu:
99%
so.. well.. WHY??? i of course can see flash handling 10000
timelines.. some timers perhaps.. but i've also tries with shapes,
and it's still going to 50%, that just doesn't feel right. i've
published to 120fps, less improves.
anybody has an idea? i hate when things take cpu where
nothing happens.

I of course tried that too: cacheAsBitmap has no improving
influence at all. Even when I leave those MovieClips or Shapes
empty, it's still eating way too much cpu imho. Okay, there
are 10000 objects to loop through with each frame cycle, but
it must be a condition like if (mc.changed) ... at least that's how
you'd expect it to work.
I've just done some more testing. The cpu heavily depends on
the mouse pointer position - if it's within the boundary containing
any DisplayObject, it eats a lot more cpu. This doesn't depend on
wether the mouse is moving or not. So my guess is that Flash Player
checks on each frame cycle wether the mouse is within the stage
boundaries, if yes it checks the mouse against all DisplayObjects,
to find out wether it shall dispatch any mouse events. Okay, that
makes more sense. I still think that this could be improved though:
First of all it should only check on mouse movement OR whenever
some kind of render flag set to true, second it could make checking
dependent on wether there are any event listeners that need
checking.
Well, at least I think I've more clue now about what's
actually happening. I still think that this could be improved very
much. I've created a little test html page, where I try to do the
same, 10000 objects, same size, same position. When I test with
browsers, cpu load depends very much on mouse MOVEMENT, meaning
that when I hover the mouse over the area and I don't move it, cpu
load is very low. When I move the mouse though, it starts eating
cpu (50% on safari, 20% on FF).

Similar Messages

  • Loading as3 swf files into as2

    im having a problem..i,e. i need to load an external swf which is in as3...and need it to be played in my as2 swf layout. with a time slider ,play, pause ,next, previous for that swf movie clip. pls give ur mail id i can sent my original files....................pls help me
    pls give ur mail id i can sent my original files.................[email protected] pls help me am doing my final year college ..........download tis jpg image and convert to rar r zip file.....project

    You'r not able to load as3 files into as2 files.

  • Embed AS3 swf into a AS2 FLA?

    HI, I have a flash site designed in AS2 and want to embed a
    AS3 video player in it. If I republish the AS2 site to AS3 the
    website doesnt function, and if I load the AS3 swf into the
    website, the Player doesnt function.
    I need the AS2 functionality on the website and I need the
    advanced AS3 functionality on the video Player.
    Is there any way to get these two guys to talk to each
    other?

    Creating a 3rd fla, to load the AS2 Fla and the AS3 FLA just
    aint gonna fly. This website is updated daily and its just too much
    of a maintenance nightmare.
    However, I do want to use Wabbits suggestion but I dont know
    how to create a web object.
    The GetURL function opens the swf on its own, which I dont
    want to do. I want it to open the AS3 SWF in a small window within
    the page.
    Can someone help please? Thanks in advance,

  • AS3 parent loading in AS2 child that in turn loads in jpegs *Problem*

    Hiya everybody.
    I'm getting a bald patch on my head from frustration with the following problem.
    I have a parent AS3 swf which loads in a AS2 swf like so;
    stop();
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest( "as2child.swf"));
    addChild(ldr);
    contained in the AS2 file is the following script which loads in jpegs when the user clicks the next button, etc.
    //stuff that loads in different photos
    stop();
    var i:Number = 1;
    //load first image straight away.
    function initialloadup () {
    i = 1;
    startLoading("pic"+i+".jpg");
    initialloadup();
    next_btn.onRelease = function () {
    /*on clicking next image button load next image in sequence*/
    i++;
    if (i > 11 ) {i = 1};
    startLoading("pic"+i+".jpg");
    trace("pic"+i+".jpg");
    prev_btn.onRelease = function () {
    //on clicking previous image button load prev image in sequence
    i--;
    if (i < 1 ) {i = 11};
    startLoading("pic"+i+".jpg");
    function startLoading(whichImage) {
    loadMovie(whichImage, "imageLoader");
    however when you view the AS2 swf via the AS3 swf it does not seem to load in the jpgs when requested.
    I need to retain the AS2 file so cannot rewrite in AS3 as the image loading thing is only a small part of the AS2 file.
    Any ideas? might it be to do with how the AS2 is read in AS3?
    Cheers for your reading this
    Melacroso

    Hi Ned,
    Cheers for your thoughts. I've heard of the lockroot thingymajig. Tried it out but to no avail.
    I've attached a zip file containing the fla's and swf's and jpgs, just incase anyone yourself included might have anymore ideas.
    Thanks for your time
    Alec

  • LocalConnection between AS3 App into Loaded AS2

    So I have an app that loads an AS2 Compiled SWF into it.
    The Main App (AS3)
    // the SWFLoader loads the ChildSWF, and on (Event.COMPLETE, openLocalConn);
    private function openLocalConn(e:Event):void {
       my_send_lc = new LocalConnection();
       my_send_lc.send("ConnCountryList", "publicMethod", "jo");
       my_send_lc.addEventListener(StatusEvent.STATUS, onStatus);
    private function onStatus(event:StatusEvent):void {
       switch (event.level) {
         case "status":
            trace("**** LocalConnection.send() SUCCESS ****" + event.toString());
            break;
         case "error":
            trace("**** LocalConnection.send() FAILED ****");
            break;
    Loaded SWFChild (AS2)
    trace ("Loaded Child SWF");
    var getArray_lc : LocalConnection = new LocalConnection();
        getArray_lc.client = this;
        getArray_lc.connect("ConnCountryList");
        getArray_lc.allowDomain('*');
    function publicMethod(jo:String) {
        trace('Eureka');
    So When I run the MainApp, The ChildSWF gets Loaded (traceout: Loaded Child SWF, it's calls the openLocalConn(), it Gives me another traceout: **** LocalConnection.send() SUCCESS ****,
    BUT I GET no traceout for the called publicMethod() in the ChildSWF in which I am supposed to see: Eureka

    LocalConnection will only work between two applications running on the same machine.
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnecti on.html
    "LocalConnection objects can communicate only among files that are running on the same client computer, but they can be running in different applications — for example, a file running in a browser and a SWF file running in Adobe AIR."
    If you need to communicate between an app running on an iOS device and a swf in a browser on a computer look into the ServerSocket Class:
    http://help.adobe.com/en_US/air/reference/html/flash/net/ServerSocket.html
    Works a little differently than LocalConnection but will allow connections between two different physical devices (ie: 2 computers, a computer and a mobile device, 2 mobile devices, etc).  Since the iOS device uses the air runtime stuff it should have access to the ServerSocket Class while the browser swf can use a standard Socket to connect to the iOS device.

  • Why does AS3 error when opening AS2 sharedObject

    I have a .sol file that can be opened using AS2 but when AS3 opens it i get RangeError: Error #2006: The supplied index is out of bounds.
    at flash.net::SharedObject$/getLocal()
    I have tried the SharedObject.defaultObjectEncoding = ObjectEncoding.AMF0 but this is for writing, not for reading.  Not sure what to do but to trap/suppress the error.  Does not solve the issue, any takers?  If it works in AS2 then it should work in AS3!

    If it works in AS2 then it should work in AS3!
    no.  you can expect the as3 compiler (when in strict mode) to detect errors that as2 bypasses.
    click file/publish settings/flash and tick "permit debugging".  retest.  the problematic line number will be in the error message.

  • AS3 loading multiple legacy AS2 accessing _level0..2

    I am building a Flex application that loads other Flex and Flash applications. The problem comes in with the legacy Flash applications, there are explicit references to _level0, 1, & 2 throughout the code base. Historically, the Flash application has a base container which is expected to be at _level0, then a middle layer and a top application referencing down to _level0.
    What I'm seeing is once a version 7 Flash app. is loaded by Flex the legacy Flash has no visibility to _level anything.
    I have tried SwfLoader and Loader with and without LoadContext ApplicationDomain.
    Any help would be greatly appreciated.
    thanks,
    Adam

    Alright, I solved this problem, only to come up with many
    more.
    To solve this problem, I needed to point to the loaderInfo
    object of the UILoader's content. So:
    simulation.content.loaderInfo.actionScriptVersion.
    Now the proxy loads correctly, but I start getting errors
    immediately. Let me paste some code to show the next steps:
    First off. I immediately receive a StatusEvent error, though
    the path gets sent into the proxy and loads correctly.
    Next, when the complete event fires in the AS2 SWF - it sends
    a completion back up to let the AS3 SWF know that it finished (and
    any handling that needs to happen at that point.) I receive the
    following error:
    Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095:
    flash.net.LocalConnection was unable to invoke callback loadSwf.
    error=ReferenceError: Error #1069: Property loadSwf not found on
    com.applied.flash.events.AS2Connect and there is no default
    value.

  • Migrate existing code of AS3 to AS2 - URLRequest, URLLoader

    Hi,
    I have written code to read an XML file by using URLRequest and URLLoader in ActionScript 3.0. Code is pasted below. This runs well in AS3.  Problem I am facing is because I wrote this in AS3, I am not able to use the DateChooser component in another part of the flash module because it seems like DateChooser component is not supported in AS3. So I want to migrate my below AS3 code back to AS2.
    **** Code in AS3 (I need help in writing equivalent code in AS2) :-
    var xmlText:XML ;
    var xmlReq:URLRequest = new URLRequest("myFile.xml");
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(xmlReq);
    xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
    function xmlLoaded(event:Event):void
        xmlText = new XML(xmlLoader.data);  
        info_txt.htmlText = xmlText.someTag ;
    **** I cannot use the above as is because, when I change the publish settings from AS3 to AS2, I get following errors -
    The class or interface 'URLRequest' could not be loaded.
    The class or interface 'URLLoader' could not be loaded.
    The class or interface 'Event' could not be loaded.
    Same works well in AS3. What should I do to make this work in AS2 or can anyone direct me in writing an equivalent in AS2.
    Please assist.
    Thanks in advance.
    MG

    parsing is done using the xmlnode methods and properties.  how you parse an xml file (in as2) depends on its structure.  but generally, you use firstChild, nextSibling, childNodes and nodeValue in the appropriate sequence to extact data.  the flash help files have sample code.  for tutorials, check google.
    if you're trying to load a cross-domain xml file, you'll have a cross-domain security issue to deal with.

  • Convert AS2 swf to AS3 swf

    I have a swf (written in AS3) that loads other swfs into it.
    There are no issues when loading other AS3 swfs but there is a
    problem loading AS2 swfs. I get the following error:
    TypeError: Error #1034: Type Coercion failed: cannot convert
    flash.display::AVM1Movie@35d3a51 to flash.display.MovieClip.
    Is there any way to convert the AS2 swf into a AS3 swf so it
    will be compatible with my loader? I cannot go back and change the
    AS2 swfs because I do not have the fla files. Or is there any way
    to incorporate AS3 code that will load AS2 swfs properly? It seems
    hard to believe that Adobe would neglect this backwards
    compatibility issue. Thanks

    Hello Andrei1,
    Thanks for looking at my simple AS3 code. The AS2 swfs that
    I've been working (and having difficulties) with are components
    that I've purchased from places like www.flashden.com. Some are
    image transitions (such as "Dynamic Image Draw found at
    http://www.flashden.net/item/dynamic-image-draw/7532)
    while another is used to create a looped banner rotator animation
    (IMG_loop, a free d/l from www.afcomponents.net). I have another
    that uses an .xml file to configure a slideshow animation.
    You mention "needing to do more" if AS2 scripts inside its
    swf are to be run by the parent AS3 fla; what would these lines of
    code be?
    In researching my problem further I've since realized that
    most of these issues deal both with the version of AS used, as well
    as the version of the Flash player the fla is set up to animate
    for. In particular, the "Dynamic Image Draw" component requires
    that Flash Player 8 or 9 be used with AS2.
    Given that many of my purchased components are like this,
    I've since changed my main fla movie from AS3 back to AS2 and have
    learned that the scripting needed to call individual multiple swfs
    into it at various points in the timeline is MUCH simpler!!!!! One
    single, easily interpreted, line of code vs. 5 lines using
    variables and much more arcane (to me) function calls.
    I started my file with AS3 figuring that I'd be better off
    learning the new version of the language; much stress and
    forehead-rubbing later, I've seen just how much easier and
    understandable AS2 is to learn.
    I recognize that there are likely very strong arguments for
    the more structured coding approach used by AS3, but for someone
    like me who wants to generate customized Flash presentations with
    little fuss, I'm not qualified to make them.
    Perhaps this is a no brainer for those many flash gurus out
    there, but for me this tiny bit of wisdom has been hard fought for!
    That being said, is there an easy way to convert a swf file
    created using AS2 to something that AS3 can work/interact with?
    I've come across a free d/l product called actionscript bridge, but
    haven't been able to understand how to get it to work.

  • Load as2 inside as3

    hi,
    I came a cross a strange problem while trying to load (using Loader Class) an as2 swf inside an as3 swf.
    I'm not sure that it matters but the as2 size is bigger.
    when i load the as2 file (even without addChild ) the overall swf that I run suddenly becomes larger and i guess getting the size of the as2 so it will fit.
    I want the parent as3 swf to keep its same size(scale).
    does anyone know how to fix this problem?
    *When i loaded an as3 instead of an as2, it worked like it should. That's why I know the as2 is the source of the problem.
    Thank you

    scale your loader so it fits the way you want.  ie, if your loaded swf is 800x600 (with nothing on the back-stage) and you're loading into a 350x375 swf, after loading is complete, use:
    loader.width *= 350/800;
    loader.height *= 375/600;

  • AS2 with AS3 integration

    Hi.
    I have loads of games in AS2 but a freelancer is developping games in AS3. Can I use a container movie in AS3 and load both AS2 and AS3 games in. Otherwise I would have to update all games into AS3. Would all games have to be published to the same flashplayer? ie: FS7 etc...

    you can use an as3 swf to load as2 swfs.  if you need to communicate between the two swfs, use the localconnection class.

  • "Export classes in frame x" in AS3: how does it work?

    My steps:
    1. I have some beefy classes
    2. I want my SWF to show a preload anim while it loads these
    classes
    3. Using the "Export classes in frame: " option, I move my
    classes to frame 10
    4. I put a stop(); on the first frame and test w/ the
    bandwidth profiler visible.
    Desired + expected behavior:
    1. My preloader spins, and I have minimal K on the first
    frame and then the main hit on the chosen export frame.
    Observed behavior:
    1. all of my classes are available on the first frame (ala,
    all of my logic can be performed on the first frame, even though
    the framehead is sitting firmly on frame 1)
    2. there is still a spike in K on the output frame
    Notes:
    - am I just missing the point here? Is this how it always
    worked?
    - why is the Document Class available in the first frame? Is
    this mandatory w/ the new structure?
    Thanks for your time and help-
    cgs

    Thanks, moccamaximum, I believe this did open up a connection and now I have no errors.
    However, my problem still persists.
    Here is what it says in the output of my AS3 flash site:
    _root
    SWFBridge (AS3) connected: host
    SWFBridge (AS2) connected as client
    imgNum: 10
    thumb: images/image1.jpg
    image: images/image1.jpg
    thumb: thumbs/image2.jpg
    image: images/image2.jpg
    thumb: thumbs/image3.jpg
    image: images/image3.jpg
    thumb: thumbs/image4.jpg
    image: images/image4.jpg
    thumb: thumbs/image5.jpg
    image: images/image5.jpg
    thumb: thumbs/image6.jpg
    image: images/image6.jpg
    thumb: thumbs/image7.jpg
    image: images/image7.jpg
    thumb: thumbs/image8.jpg
    image: images/image8.jpg
    thumb: thumbs/image9.jpg
    image: images/image9.jpg
    thumb: thumbs/image10.jpg
    image: images/image10.jpg
    4
    _root
    4
    163
    _root
    163
    67
    _root
    67
    43
    _root
    43
    56
    _root
    56
    20
    _root
    20
    85
    _root
    85
    64
    _root
    64
    3
    _root
    3
    I don't understand how its able to trace that it is getting the images in the path, yet there are no images to be seen in the gallery!
    I found out that my gallery does work (with images and all) when loaded into a movieclip in a blank AS2 file instead of my AS3 site. Am I doomed since even localconnection will not help?

  • How to check Buttons in AS3

    What is the AS3 equivalent of this AS2 code? I don't want to
    have to type this for every MC or button (especially if there are
    many):
    Button.prototype.buttonMode = true;

    I apologize again. If I had read my own code carefully, TRUE
    should be FALSE.
    I want to toggle all buttons using this. I got it. Thanks. No
    problem. Cool.

  • As3 mp3 encode problem

    Hi,
    We are developing an app that could play mp3s from a music store. We found that the downloaded mp3 from the store can't play be as3's Sound class. The file's information can be load, but just not to play. Same code (something like new Sound(); load(urlrequest);play();..) will work to some of other mp3s. I've searched from internet. Looks like this is only way to play mp3s by AS3. Some older AS2 code could play these mp3s by sound.loadSound(). I don't understand why the old method is better than the newer one, and it is in same flash editor and player. I re-encoded the mp3s by Adobe Media Encoder, and the AS3 player will work. But I can't do it for every customer's downloaded mp3. From internet, I can't find what is the specification of Flash friendly mp3 Encode. And every other mp3 player can play these mp3s even Flash AS2.
    Please help!
    Andy

    The reason I listed as3 and as2 code with local mp3 is showing you even the code is simple like that, it is still not working. So I don't expect it could work with more complicated situation, and how wired it isthat AS2 code could work but not AS3.
    It will be an iOS app, but anyway it will be running by swf, right?
    The music will be downloaded from the music store, but it will be running in the local folder, not stream from internet.
    So the code for music playing will just be like that:
    import flash.media.*;
      var snd:Sound = new Sound();
      snd.load(new URLRequest("Music.mp3"));
      snd.play();

  • Mixing AS2 and AS#

    So currently my game company is using AS2. We have a
    shell.swf that loads in all of our games. The shell is written in
    AS2 like all of our other stuff. Some of our games we have
    contracted others to make. Those other people are converting to
    AS3. Can our AS2 shell still be able to load AS3 swfs? Or does
    EVERYTHING have ot be in AS3 or AS2 for it to work?
    Thanks!
    Kyle

    an as3 shell can load as2 and the as2 code will work. but an
    as2 shell that loads an as3 swf will prevent the as3 code from
    working.

Maybe you are looking for

  • Rich Text editor in Webdynpro

    Hi, With the new FormattedTextView in 2004s one will be able to render xhtml compliant rich test in Webdynpro. This however only covers the rednering of rich text. There still does not seem to be a rich text editor control available for webdynpro app

  • Samsung CLP-300 attached to Airport Express Base Station: Issues

    I have found that my Samsung CLP-300 printer, which is connected to my Airport Express Base Station via USB, refuses to print after printing one document. After restarting my Airport Express Base Station, I found that the printer would start printing

  • Upgrade Mac OS 3.9?

    Is it possible to upgrade Mac OS 3.9 to a higher version on my iMac G5? I have checked for automatic updates by going into the apple icon drop down to "software updates..." but no Mac OS updates are suggested. Thanks in advance for your recommendatio

  • Idocs not updated.

    hi,    i am using an Idoc message type : HRMD_A and basic type : HRMD_A07 for updating values in the segment EP10105 in LSMW. When the Idocs are processed they are getting posted succefully, but the values are not getting reflected in the table. any

  • Generating a delayed digital pulse

    Hi, I have two digital inputs, read via a DAQmx assistant, one represents a one pulse per revolution, the other one pulse per crank angle degree (hence 360 per rev) which are generated by an optical encoder attached to the shaft of a small engine set