1 Reply Latest reply on Jul 7, 2008 7:22 AM by ShinSeven

    titlewindow popup problem

      Hi folks,

      I've got a bizarre problem with a Titlewindow popup. I've made a flex app that when a button is pressed, a titlewindow is popped up my main canvas area. The program runs fine, no problems whatsoever - so I embed the swf into an html for viewing it. This works fine, if width and height are all labeled as 100%, or if they're properties that are actually *smaller* than the canvas size itself (for example, width of the embed is 700, width of the canvas is 750). However, If I use an embed that is slightly larger than the canvas size, I get this error when clicking the button that calls the function to popup the titlewindow:

      RangeError: Error #2006: The supplied index is out of bounds.
      at flash.display::DisplayObjectContainer/getChildAt()
      at mx.core::Container/getChildAt()
      at mx.containers.utilityClasses::CanvasLayout/updateDisplayList()
      at mx.core::LayoutContainer/updateDisplayList()
      at mx.core::Application/updateDisplayList()
      at mx.core::UIComponent/validateDisplayList()
      at mx.core::Container/validateDisplayList()
      at mx.managers::LayoutManager/validateDisplayList()
      at mx.managers::LayoutManager/doPhasedInstantiation()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()
      at mx.core::UIComponent/callLaterDispatcher()

      I'm completely stumped as to why it's doing this. The main factor seems to be if there are scroll bars on the canvas - if the embed area is small enough to require scroll bars to be able to see the whole canvas, then this error doesn't happen - if it's big enough to be bigger than the canvas itself so no scroll bars are required, this error is thrown.

      Anyone experienced anything like this?

      here's the code from the function that calls the popup:

      private function launchOverWin(currentPopup:TitleWindow, currentVid:VideoDisplay):void{

      /* either one of these following 2 statements are fine by themselves. but together, they seem to cause a problem, when the embed area is large enough */

      PopUpManager.addPopUp(currentPopup, mainCanvas, true);
      currentPopup.visible = true;


      Here is the code from the titlewindow - I include the titlewindow in my main mxml file, the code is right above the <mx:Canvas> area. I set visible to false, and my function above when calling the add popup, sets the visible to true.

      <mx:TitleWindow visible="false" id="titleWinOne" title="Viewing Demo" showCloseButton="true" width="510" height="450" close="closePopup(event, titleWinOne, DemoVid);" x="40" y="40">
      <mx:VideoDisplay id="DemoVid" autoPlay="false" playheadUpdate="videoDisplay_playheadUpdate(DemoVid);" source="source.flv" height="360" width="480"/>
      <mx:Button styleName="pauseButton" click="DemoVid.pause();"/>
      <mx:Button styleName="playButton" click="DemoVid.play();"/>
      <mx:HSlider styleName="sliderStyle" id="slider" width="280" allowTrackClick="false" invertThumbDirection="true" maximum="{DemoVid.totalTime}" minimum="0" thumbRelease="sliderRelease(DemoVid)" thumbPress="sliderPress(DemoVid)" value="{DemoVid.playheadTime}" />
      <mx:Label styleName="timeStyle" id="timeDisplay" textAlign="right" />

      If anyone is able to shed some insight on why this error is being thrown, I'd greatly appreciate it.