3 Replies Latest reply on Dec 8, 2010 10:59 AM by bluedragDminor

    Dynamically Changing Display Quality for Children

    boneitis

      I am interested in changing the display quality for a child SWF that is loaded in at Runtime, and changing it's Display quality based on user interaction.  Anyone know if this is possible?

       

      I have the following below, however it changes the entire application, not just the dynamically loaded SWF

       

      Any help would be greatly appreciated.

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        xmlns:s="library://ns.adobe.com/flex/spark" 
                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                        applicationComplete="init()">
           <fx:Declarations>
           </fx:Declarations>
           
           <fx:Script>
                <![CDATA[
                     private var mc:*;
                     
                     private function init():void{
                          var loader:Loader = new Loader();
                          loader.contentLoaderInfo.addEventListener( Event.COMPLETE, handleComp );
                          loader.load( new URLRequest( "my/swf/file.swf" ) );
                     }
                     
                     private function handleComp( _event:Event ) :void{
                          mc = (_event.target.content) 
                          av.addChild( mc );
                     }
                     
                     private function changeQuality( _q:String ):void{
                          switch (_q){
                               case "low":          av.stage.quality = "low";          break;
                               case "medium":     av.stage.quality = "medium";     break;
                               case "high":     av.stage.quality = "high";          break;
                          }
                     }
                ]]>
           </fx:Script>
           <s:VGroup>
                <s:HGroup>
                     <s:Button label="low" click="changeQuality( 'low' )" />
                     <s:Button label="medium" click="changeQuality( 'medium' )" />
                     <s:Button label="high" click="changeQuality( 'high' )" />
                </s:HGroup>
                <s:SpriteVisualElement id="av" height="300" width="100" />
           </s:VGroup>
      </s:Application>