@Alex - Good to know you're still lurking :)

@Vocal - As Alex suggests, there is extra code in the debug versions of the
swf which would allow a remote debugger (Flex Builder or Flash IDE) to
attach to the swf and get to breakpoints, object stacks etc. I imagine this
is a combination of two things. a) You are publishing a debug version of the
swf from Flex. b) You are running a debug version of the Flash player.

I am thinking if either of the two conditions are not true, you will see the
performance increase.

BTW- good work for keeping at it, and getting to the bottom of the issue :)


Aran


On Thu, Feb 18, 2010 at 4:45 AM, Philip Hutchison <[email protected]>wrote:

> Hi Vocal
>
> SWFObject does not analyze or communicate with the contents of a SWF, so it
> doesn't care whether it's a debugger SWF or production SWF. All it does it
> write an <object> to the DOM based on the parameters you provide.
>
> I suspect that the issue lies in Flash Player and the SWFs themselves. I'm
> guessing if you try your embed with something other than SWFObject, you will
> still see the load times vary between the debugger and production SWFs.
>
> - philip
>
>
>
> On Wed, Feb 17, 2010 at 8:33 AM, Alex Harui <[email protected]> wrote:
>
>>  Debug builds have extra opcodes for the debugger and do not have
>> optimized constant pools so that will definitely make them slower than
>> release builds.
>>
>>
>>
>> On 2/17/10 8:23 AM, "Sam Sherlock" <[email protected]> wrote:
>>
>> I don't know about flex but I would expect debug builds to have an
>> additional overhead compared with production builds
>>
>>  - S
>>
>>
>>
>>
>> On 17 February 2010 16:02, VocalPlayboy <[email protected]> wrote:
>>
>> Here's an example:
>>
>> Both pages are identical except for the swf file (a.swf).
>> a.swf is built from the same source but just published differently as
>> either release or debug.
>>
>>
>> http://www.strangeloopstudios.com/swfobject_multiple_embed/debug_build_swf/
>> - slow.
>> or
>>
>> http://www.strangeloopstudios.com/swfobject_multiple_embed/release_build_swf/
>> - fast.
>>
>> ponder that!
>>
>> On Feb 17, 3:46 pm, VocalPlayboy <[email protected]> wrote:
>> > This is going to sound odd, so i hope i'm wrong but...
>> >
>> > It's nothing to do with having an empty swf (surprise) - after doing
>> > some tests i suspected that only Flash IDE swfs were working as
>> > anything i tested built in Flex Builder 3 wouldn't work, yet using any
>> > other swfs locally or swiped from the net worked fine.
>> >
>> > I thought why not try a bin-release version of any of the swf files i
>> > had already tried (which all came from bin-debug) within Flex Builder
>> > 3... and there it was, if its a bin-debug swf using my code above the
>> > page hangs and hangs but if i test using bin-release it's there
>> > instantly as expected. I have tested with 6 seperate swf applications
>> > ranging in complexity and size from a couple of hundred kilobytes to a
>> > couple of meg.
>> >
>> > Every time it's instant! Bizarre...
>> >
>> > So what's the difference? Is swfobject waiting for something from the
>> > swf that is not instantly available in a debug version but is in a
>> > release build?
>> > I'm assuming that Flash IDE always publishes the equivalent of a Flex
>> > Builder release build, so maybe this is actually a swfobject bug that
>> > only shows with multiple debug files?
>> > Maybe it's there for a single debug file but just hard to notice...
>> > i've tried it with just 1 swf and the release is always slightly
>> > faster to render a page.
>> >
>> > Any comments? Does this make sense?
>> >
>> > On Feb 17, 3:19 pm, VocalPlayboy <[email protected]> wrote:
>> >
>> > > Hi All,
>> >
>> > > I've sussed the issue and the swfobject code and my js above does
>> > > indeed work - very fast!
>> > > However what i've noticed is that it only works with swf files that
>> > > have something in them.
>> >
>> > > My flex and/or as classes looked like this:
>> >
>> > > AS ONLY
>> > >
>> ###############################################################################
>> > > ->
>> >
>> > > package
>> > > {
>> > >         import flash.display.Sprite;
>> > >         import flash.external.ExternalInterface;
>> > >         [SWF(widthPercent="100", heightPercent="100", frameRate="40",
>> > > backgroundColor="#242424")]
>> > >         public class a extends Sprite
>> > >         {
>> > >                 public function a()
>> > >                 {
>> > >                         if(ExternalInterface.available)
>> > >                         {
>> > >                                 ExternalInterface.marshallExceptions =
>> true;
>> > >                         try
>> > >                         {
>> > >
>> ExternalInterface.call("initializedOk", "test");
>> > >                         }
>> > >                                 catch(e:Error){}
>> > >                         }
>> > >                 }
>> > >         }
>> >
>> > > }
>> >
>> > > FLEX
>> > >
>> ###############################################################################
>> > > ->
>> >
>> > > <?xml version="1.0" encoding="utf-8"?>
>> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>> > >         layout="absolute"
>> > >         applicationComplete="_initJS()"
>> > >         creationComplete="_initApp()">
>> > >         <mx:Script>
>> > >                 <![CDATA[
>> > >                         import flash.utils.getQualifiedClassName;
>> > >                         import flash.external.ExternalInterface;
>> > >                         private var __swfName:String;
>> > >                         private function _initJS():void
>> > >                         {
>> > >                                 __swfName =
>> getQualifiedClassName(this);
>> > >                                 if (ExternalInterface.available)
>> > >                                 {
>> > >
>> ExternalInterface.marshallExceptions = true;
>> > >                         try
>> > >                         {
>> > >
>> ExternalInterface.call("initializedOk", __swfName);
>> > >                                 }
>> > >                                 catch(e:Error){}
>> > >                                 }
>> > >                         }
>> > >                         private function _initApp():void{}
>> > >                 ]]>
>> > >         </mx:Script>
>> > > </mx:Application>
>> >
>> > > Just empty except for the ExternalInterface logic. When i try to embed
>> > > either of these... page renders sloooooooooow
>> > > But if i grab a swf from anywhere else (and of any size), the embed is
>> > > lightning fast as expected....
>> > > So what does that actually mean?????..... i will try to find out.
>> >
>> > > Cheers
>> > > Doug
>> >
>> > > On Feb 17, 9:28 am, VocalPlayboy <[email protected]> wrote:
>> >
>> > > > Hey Vince,
>> >
>> > > > Ok good call with the manager idea but i still don't think it will
>> > > > make a difference, the delay comes from the actual js embed, as if
>> > > > it's waiting for each swf to load maybe (i don't know).
>> > > > If i try the same code locally it still takes just as long and if i
>> > > > swap out my flex component swfs for normal swfs (so no flex
>> framework)
>> > > > or need for an rsl it still takes the same amount of time.
>> >
>> > > > It would be good to see some other examples of multi swf embedding
>> > > > techniques.
>> >
>> > > > Cheers
>> > > > Doug
>> >
>> > > > On Feb 16, 6:50 pm, Vincent Polite <[email protected]>
>> > > > wrote:
>> >
>> > > > > Hey Vocal, I took a brief look at your page.  I haven't looked at
>> the actual
>> > > > > SWFObject code, because generally speaking, if it's implemented
>> correctly
>> > > > > it's usually not the problem.
>> >
>> > > > > Using the Net Panel tool in Firebug, I was able to note that the
>> number of
>> > > > > connections being farmed out to your server, DNS lookups
>> contribute to the
>> > > > > lions share of delay for your page loading.  Using this link
>> (maybe
>> > > > > outdated) as reference, it notes that there is a default max # of
>> > > > > connections allowed from the same page by Firefox.  I'm assuming
>> that other
>> > > > > browsers may have this limitation as well to make it slightly less
>> trivial
>> > > > > for a single browser to bring a web server to it's knees?
>> >
>> > > > >
>> http://groups.google.com/group/firebug/browse_thread/thread/04d1a83b9...
>> >
>> > > > > I looked at your demo page, it didn't seem to hang for me, just
>> took a bit
>> > > > > using FF3.5 on a PC.  Using IE8 on the same PC, I got similar
>> performance
>> > > > > characteristics.  At first blush, it would seem like your server
>> is the
>> > > > > limiting factor, but maybe I'm wrong about that.
>> >
>> > > > > ----
>> >
>> > > > > 15 minutes later.
>> >
>> > > > > Took a gander at your code.  You actually do something very
>> similar to some
>> > > > > work I did to deal with a random number of SWFObjects on a page in
>> terms of
>> > > > > pushing elements into an array and what not.  You might want to
>> consider
>> > > > > abstracting these for loops you have into something called a
>> > > > > SWFObjectManager class and instead of passing around the objects
>> themselves
>> > > > > which if you're not passing by reference might be more CPU work
>> than not,
>> > > > > that you just pass the element names around and only perform the
>> operations
>> > > > > as needed.  You would need to test out which is more efficient
>> though.
>> >
>> > > > > SWFObjectManager.register("nameofDiv", "pathtoSWF", otherparams);
>> > > > > SWFObjectManager.register("...","...",otherparams);
>> >
>> > > > > if you use a lightweight framework like jQuery you could even tag
>> your divs
>> > > > > with something like class="swfobject" and then use a .each()
>> selector to
>> > > > > grab all the swfobjects on your page and then just instantiate
>> your
>> > > > > swfobjects based on the meta data on your page.
>> >
>> > > > > i.e. <div id="foo" class="swfobject" >Alt Content</div>
>> >
>> > > > > Then your JS would be potentially reduced quite a bit:
>> >
>> > > > > $(document).ready(function() {
>> > > > >      $(".swfobject").each(function() {
>> > > > >           divId = $(this).id;
>> > > > >           swfName = divId+".swf";
>> > > > >           properties = {data:swfName, width:100, height: 100};
>> > > > >           parameters = {menu: false};
>> > > > >           swfobject.createSWF(properties, paramters, divId);
>> > > > >      }
>> >
>> > > > > }
>> >
>> > > > > It does appear that you are reusing the global arrays for some
>> reason, so
>> > > > > for maintainabilities sake, you might consider upgrading your
>> arrays to a
>> > > > > type of SWFObjectManager class and make your calls a bit more
>> compact.
>> >
>> > > > > i.e. your SWFObjectManager class would use a loop like the one
>> above to
>> > > > > naturally grab all the divs of class swfobject and define them
>> > > > > appropriately, so your inline JS gets reduced to:
>> >
>> > > > > $(document).ready(function() {
>> > > > >      SWFObjectManager.init();
>> >
>> > > > > });
>> >
>> > > > > So sorry, stream of consciousness after Chinese New Year.  If this
>> confuses
>> > > > > or is off point for you, then dump this in the recycle bin.
>> >
>> > > > > VincentOn Tue, Feb 16, 2010 at 9:57 AM, VocalPlayboy <
>> [email protected]> wrote:
>> > > > > > Check out these 2 demos.
>> >
>> > > > > > First one the page hangs -
>> > > > > >http://www.strangeloopstudios.com/swfobject_demo/
>> >
>> > > > > > Second one there is a slight delay but at least it loads the
>> page
>> > > > > > quicker -http://www.strangeloopstudios.com/swfobject_demo2/
>> >
>> > > > > > I'll also check out your app later, got to head out now, but
>> thanks.
>> >
>> > > > > > Doug
>> >
>> > > > > > On Feb 16, 5:02 pm, Steve <[email protected]> wrote:
>> > > > > > > Is it the size of your swfs themselves? If not, I have created
>> an
>> > > > > > > application that does what you want and writes the code for
>> you. Just
>> > > > > > > browse to your web page, drag and drop your swfs onto the page
>> where
>> > > > > > > you want them, set their properties, and click publish:
>> >
>> > > > > > >http://norrisoftenhance.ning.com/
>> >
>> > > > > > > The application includes a getting started tutoriaal and help.
>> >
>> > > > > > > Steve
>> >
>> > > > > > > On Feb 16, 9:38 am, VocalPlayboy <[email protected]>
>> wrote:
>> >
>> > > > > > > > Hi All,
>> >
>> > > > > > > > I'm building a modular video application with a bunch of
>> Flex
>> > > > > > > > components and part of the requirement is to use javascript
>> as a
>> > > > > > > > controller to communicate between my data model and my flex
>> component
>> >
>> > ...
>> >
>> > read more ยป
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "SWFObject" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected] <
>> mailto:swfobject%[email protected]<swfobject%[email protected]>>
>> .
>>
>> For more options, visit this group at
>> http://groups.google.com/group/swfobject?hl=en.
>>
>>
>>
>> --
>> Alex Harui
>> Flex SDK Team
>> Adobe System, Inc.
>> http://blogs.adobe.com/aharui
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "SWFObject" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<swfobject%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/swfobject?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "SWFObject" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<swfobject%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/swfobject?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en.

Reply via email to