Error #2025 – Clash between Flex 2 & Flash CS3

I got my new copy of Flash CS3 and proceeded to make a new preloader for my Flex application.  I made a document Class for my CS3 file and attached a CS3 ProgressBar component.  I had a public function in the Document Class for setting the progress of the Flex preloading.   I dropped the SWF file into my Flex document and set up all the preloading code.  If you set a preloader in Flex it will load that file in the first frame before it loads the rest of the Flex application.  You can do progressive preloading the same way you would in Flash.   The CS3 preloader worked like a charm because with CS3, I can now (though still not elegantly) talk to the functions inside the loaded SWF file.   Here is the CS3 Document Class code:

package com.preloader
	import flash.display.MovieClip;
	import fl.controls.ProgressBar;
	import fl.controls.ProgressBarMode;

	public class WelcomeScreenClass extends flash.display.MovieClip
		private var progressBar:ProgressBar;

	        public function WelcomeScreenClass()
			progressBar = new ProgressBar();
			progressBar.indeterminate = false;
			progressBar.mode = ProgressBarMode.MANUAL;
			progressBar.setSize(150, 22);
			progressBar.move(10, 50);
			progressBar.setStyle("barPadding", 3);
			progressBar.setProgress(50, 100);


		public function setLoaderProgress(loaded:Number, total:Number):void
			progressBar.setProgress(loaded, total);
			trace("loaded: " + loaded + " of total: " + total);

This all sounds good so far, a decent marriage between Flash and Flex, weeee!!   About a week later I noticed a bug in my Flex application.  Every time you hit the Tab key on any dialog created with the PopUpManager or even the Alert, I would get the following error code:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
 at flash.display::DisplayObjectContainer/getChildIndex()
 at mx.core::Container/getChildIndex()
 at mx.containers::Panel/getChildIndex()
 at fl.managers::FocusManager/::getChildIndex()
 at fl.managers::FocusManager/::sortByDepth()
 at fl.managers::FocusManager/::sortByTabIndex()
 at Array$/Array::_sort()
 at Array/
 at fl.managers::FocusManager/::sortFocusableObjectsTabIndex()
 at fl.managers::FocusManager/::sortFocusableObjects()
 at fl.managers::FocusManager/::keyDownHandler()

This particular bug is very vague and a search of the Internet yielded nothing that seem to fit my situation.  I am using Cairngorm with Modules and my suspicion was that I had created a shared code typology.   Modules are cool because they can reduce your initial application load, but they are a real pain in the ass to manage because you run into these strange bugs that always seem related to a race condition with loading one Class or Manager into one module.    I spent a few days tracking down this issue, testing each module, commenting out code.  I finally created a new project without any modules, determined that it was the shared code typology issue.  I still had the same issue.

Something about the error dawned on me, the “fl.managers”.   This is a CS3 code package that Flex does not have.   I then decided to remove my CS3 prelaoder, and guess what, the bug went away.  I had inadvertently created my own bug by using CS3 with the new ProgressBar component.  This component most likely extends UIComponent, which contains the FocusManager, and therefore, causes the issue with the FocusManager in Flex.  According to shared code typology 101, the first instance of the loaded manager wins.

The solution was to yank out the CS3 ProgressBar component and just create my own progress bar using the Flash drawing tools.   This was a tough error, and probably not the first one that will be encountered as Flash and Flex start mingling more in the near future.  



  1. I agree with you if your point is that Flex and Flash CS3 do not work that well together, as anyone who has used Flex to write the code for a CS3 app can confirm. The fact that packages are different may throw some users off course right away. Knowing what Flex packages to export into Flash and what Flash packages into Flex can be hit and miss.

    I’d never figured your bug out man!

  2. Yeah, its funky right, it like two versions of AS3, and they don’t like each other. This mofo problem cost me days and lots of stress. I hope that Flex3 will resolve some of the inconsistencies.

  3. […] Jesse Warden has a great new article about developing a custom Flex preloader using Flash (a cooler preloader as he calls it).  He also has a new look for his blog that you can now read (just kidding Jesse).   Jesse’s post relates to my previous post regarding Error #2025.  When I developed a custom preloader in Flash I made the terrible mistake of using a Flash 9 component that caused a huge error in my Flex app.    Jesse’s post is part 1 of 3, so look forward to subsequent posts.  […]

  4. I am trying to do some straight forward transfer of an AS3 flash class into a flex project.
    I make a reference to the fl folder on my c drive, and the fl. start showing up in the intelisense in Flex as I expected.
    Eg. I import:
    import fl.controls.*;

    But when I com to compile the AS3 class which compiles fine in Flash, I am getting compile errors like: “1046: Type was not found or was not a compile-time constant: SliderEvent”.

    Anyone know a foolproof way how I take a working Flash .as class, and compile it in Flex?

  5. the fl.controls package is only in Flash 9, I am not sure, but you could check if Flex 3 Beta has the packages. That is why you are getting the errors.

  6. You should be able to compile the Flash application and import the SWF using SWFLoader, this will give you access to the file in Flex 2.

  7. I have a Breeze like project in which a part or my project i.e. a small module have tree component and Web Service integration into it.

    But i found that neither Tree component nor Webservices API is available in CS3. So i thought to make that particular module in Flex and rest of my application in CS3.

    The questions are:
    1. Any idea what problems are there in store for me in this integration. (My project is FMS project something like Breeze but not exact replica.)
    2. How can i call a method or update variables in CS3 file from flex file. Here i will be importing swf file created in flex into CS3. Please suggest me something here a small example or hint how can i accomplish that.

  8. Hi,

    I have a flex application, and I need to compile it to run with Flash Player 7.

    Someone can tell me if it’s posible to do, if it’s possible, how can I do that.


  9. One one hand, it’s nice someone’s figured this out. On the other, I’m disturbed that Adobe can’t even make its own products work together. That doesn’t bode well for the for the rest of their architecture.

  10. Hey I am just getting started with Flex. I would like to use php as the server side scripting…I have bought a book on Flex and they recommend that I use CF, however it can be expensive to host CF. Any recommendations?? Thanks

  11. I just had exactly this situation and solved it same way as you did.. Removed f** cs3 preloader bar and bug was gone!!
    Thank you for this!

  12. Just letting you know, I got the same exact error in a .fla that has nothing to do with a flex application. What a baffling error…. so thank you for writing about it.

    I’m guessing others will come to this page when they experience the same thing. So here’s what I have:

    A common preloader in the first frame with this as3 code:

    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
    this.loaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);

    function onLoadProgress(event:ProgressEvent):void
    var percent:Number = Math.round((event.bytesLoaded / event.bytesTotal) * 100 )
    this.loaderr.prcnt.text = percent + “%”;

    if (percent > 95) {;
    } else {


    function onLoadComplete(event:Event):void

    And i get the same exact error #2025 when I try to tab from one input text box to the next.
    Still not sure what the conflict is here…

    1. So yea, it wasn’t the preloader – it was a gallery. Unfortunately i deleted it so I can’t report what exactly conflicted – but I think people get the idea. Thanks again for writing on this.

Comments are closed.