Flex4 preloader: cannot change stageWidth and stageHeight to anything but defaults?

I've made a class to extend SparkDownloadProgressBar and added it to the the preloader="" mxml in the <s:Application> tag. the flash object width and height in the html is set to 100%, as well as in the <s:Application> tag. No matter what i set in the application, i can't get the stageWidth and srtageHeight set to anything but the defauts: 500x375. any ideas? here's my code for the SparkDownloadProgressBar class:
package components
    import com.greensock.TweenMax;
    import com.greensock.plugins.TransformAroundCenterPlugin;
    import com.greensock.plugins.TweenPlugin;  
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.ProgressEvent; 
    import mx.events.FlexEvent;
    import mx.preloaders.SparkDownloadProgressBar;
    public class TJProgressBar extends SparkDownloadProgressBar
        private var PreloaderSymbol:Class = TJPreloader; ///from libs/TJProgressBar.swc
        private var _preloaderSymbol:TJPreloader;
        private var _preloader:Sprite;
        public function TJProgressBar()
            super();
               TweenPlugin.activate([TransformAroundCenterPlugin])
            _preloaderSymbol = new PreloaderSymbol(); //in libs TJProgressBar.swc
            _preloaderSymbol.does_he.visible = false;              
             addChild(_preloaderSymbol); 
             centerPreloader()
             TweenMax.from(_preloaderSymbol,4,{rotationY:12, onComplete:preloaderComplete})
        private function centerPreloader():void{
             trace('centering: '+stageWidth+" "+stageHeight)
              _preloaderSymbol.x = stageWidth/2;
             _preloaderSymbol.y = stageHeight/2; 
        override public function set preloader(preloader:Sprite):void{
            _preloader = preloader;
            _preloader.addEventListener(ProgressEvent.PROGRESS, onDownloadProgress);
            _preloader.addEventListener(FlexEvent.INIT_COMPLETE, onFlexInitComplete);
        private function onDownloadProgress(event:ProgressEvent):void{
            var percent:Number = (100 * (event.bytesLoaded / event.bytesTotal)) >> 0;
            _preloaderSymbol.updatePreloader(percent);
        private function onFlexInitComplete(event:FlexEvent):void{
             _preloaderSymbol.does_he.visible = true
             TweenMax.killTweensOf(_preloaderSymbol)
             TweenMax.to(_preloaderSymbol,.5,{transformAroundCenter:{rotationY:0}, onComplete:preloaderDelay})
        private function preloaderDelay():void{
            TweenMax.delayedCall(.5,preloaderComplete);
          private function preloaderComplete():void{
            TweenMax.killTweensOf(_preloaderSymbol)
            removeChild(_preloaderSymbol);
            killEventListeners();
            killObjects();
            dispatchEvent(new Event(Event.COMPLETE));
        private function killEventListeners():void{
            _preloader.removeEventListener(ProgressEvent.PROGRESS, onDownloadProgress);
            _preloader.removeEventListener(FlexEvent.INIT_COMPLETE, onFlexInitComplete);
        private function killObjects():void{
             _preloader = null;
            _preloaderSymbol = null;
            PreloaderSymbol = null;
        // Override to return true so progress bar appears
        // during initialization.      
        override protected function showDisplayForInit(elapsedTime:int,
            count:int):Boolean {
                return true;
        // Override to return true so progress bar appears during download.    
        override protected function showDisplayForDownloading(
            elapsedTime:int, event:ProgressEvent):Boolean {
                return true;

i figured it out! it turns out the stageWidth and stageHeight is not set until the preloader is set. so i moved the centerPreloader() from the constructor to the preloader setter:
        override public function set preloader(preloader:Sprite):void{
              _preloader = preloader;
             centerPreloader();
                _preloader.addEventListener(ProgressEvent.PROGRESS, onDownloadProgress);
            _preloader.addEventListener(FlexEvent.INIT_COMPLETE, onFlexInitComplete);
worked perfect! Thanks for the help. -b

Similar Messages

  • Just downloaded Firefox 6.0 and have restarted 4 plus times, but it continues to hang while launching. I cannot open new windows, change any settings, or do anything but Force Quit. I'm on Mac OSX 10.5.8. How do I get past this hang?

    Just downloaded Firefox 6.0 and have restarted 4 plus times, but it continues to hang while launching. I cannot open new windows, change any settings, or do anything but Force Quit. I'm on Mac OSX 10.5.8. How do I get past this hang?

    Long story short: Simply get CC for teams. At 500 bucks a year it's a steal and those 5 licenses in the base package (or was it 10 even?) cover all your computers, at least the 3 ones you mentioned. For system requirements refer to the individual product pages.
    Mylenium

  • HT3140 put a date 1970 june 27 . and now the whole system is out of control i cant get to internet cannot change date and time  always when i opened system preferences stays in a waiting mode but doesnt show any opcion don t know what to do and i just bou

    put a date 1970 june 27 . and now the whole system is out of control i cant get to internet cannot change date and time  always when i opened system preferences stays in a waiting mode but doesnt show any opcion don t know what to do and i just bought this computer

    It may well be a driver issue but considering the loading: Xorg trying to load different drivers is somewhat normal. @cafe you can see that these are autoconfigured by X above the loading in the log:
    Jul 20 19:48:24 arch gdm-Xorg-:0[216]: (==) Matched intel as autoconfigured driver 0
    Jul 20 19:48:24 arch gdm-Xorg-:0[216]: (==) Matched intel as autoconfigured driver 1
    Jul 20 19:48:24 arch gdm-Xorg-:0[216]: (==) Matched modesetting as autoconfigured driver 2
    Jul 20 19:48:24 arch gdm-Xorg-:0[216]: (==) Matched fbdev as autoconfigured driver 3
    Jul 20 19:48:24 arch gdm-Xorg-:0[216]: (==) Matched vesa as autoconfigured driver 4
    As long as one of the drivers gets loaded, which it apparently does the failing of the others is fine.
    Was there an update maybe ?

  • Contacts and Message not showing names but numbers. Tried changing language and resetting my phone but failed. I am using Starhub in Singapore currently.

    Tried changing language and resetting my phone but failed. I am using Starhub in Singapore currently.

    The reset link will show on your account if you have a rescue email address on it, if you only have alternate email addresses then it won't show.
    If the country where you and your iTunes account are isn't on this page (you need to be in a country to use its store) : http://support.apple.com/kb/HT5699
    then you can try contacting support via this page and explain that you've forgotten your answers, don't have a rescue email address, and your country isn't on the HT5699 page and see what they reply with : https://ssl.apple.com/emea/support/itunes/contact.html

  • I have changed provider and inserted new sim but it shows 'sim not valid' does anyone know how to unlock iPhone 5?

    i have changed provider and inserted new sim but it shows 'sim not valid' does anyone know how to unlock iPhone 5?

    Yes, contact the carrier the iPhone is locked to.
    Only they can officially unlock the iPhone and if you qualify. No one else.

  • OSX 10.5.8- cannot change date and time. Have changed pram battery, still have spinning rainbow dot.

    I have an older Powermac G5 dual PPC processor with OSX 5.8 (Leopard) on it. I cannot change the date and time, all I get is the spinning rainbow disc and the prefs have to be shut down. Does anyone know how to get this back on track? Thanks in advance!

    Let''s try a new admin account...
    Reset OS X Password Without an OS X CD...
    http://theappleblog.com/2008/06/22/reset-os-x-password-without-an-os-x-cd/
    Admin Hack...
    http://www.hackmac.org/?q=node/4
    Starts up like the first time you buy a new Mac, but after filling in all that info again, you should have access to the computer and the other Users & files will still be there... give the new User a different name than an existing one.

  • Cannot change song and artist name???

    After the update to iTunes 12.0.1 I cannot change the song names or info. I can look at it but it will not let my type it in. I have some songs that are missing information and would like to edit them so that I have the artist name and song title. Help?

    this will answer your question:
    https://discussions.apple.com/thread/4577261?start=0&tstart=0

  • Why I cannot change font  and Color in JFrame title??

    Dear sir:
    I try to change font and Color in JFrame title in code below,
    It display all html code, not expected formatted ones.
    but fail. Looks like no way to do it??
    Can somebody help??
    Thanks
    import java.awt.BorderLayout;
    import java.awt.Toolkit;
    import javax.swing.*;
    public class JFrameTester {
      public static void main(String[] args) {
         String iconPath ="file:C:/eclipse/workspace/Test/images/long.PNG";
         String title = "<html><body bgcolor=\"yellow\">" + "<img src=\""+iconPath+"\">" +
              " <font size=\"6\" face=\"Verdana\" color=\"red\"><b>"+ "New Tester" + "</b></font></html>";
        JFrame f = new JFrame(title);
        f.setIconImage(Toolkit.getDefaultToolkit().getImage("images/123.gif"));
        f.setSize(250, 250);
        f.setLocation(300,200);
        f.getContentPane().add(new BorderLayout().CENTER, new JTextArea(10, 40));
        f.setVisible(true);
    }

    Looks like no way to do it??depends on the L&F you want.
    here's one way
    import java.awt.*;
    import javax.swing.*;
    class JFrameTester {
      public static void main(String[] args) {
        JFrame.setDefaultLookAndFeelDecorated(true);
        UIManager.put("activeCaption", new javax.swing.plaf.ColorUIResource(Color.RED));
        UIManager.put("activeCaptionText", new javax.swing.plaf.ColorUIResource(Color.YELLOW));
        String title = "Hello World";
        JFrame f = new JFrame(title);
        f.getLayeredPane().getComponent(1).setFont(new Font("Tall Paul",Font.ITALIC,24));
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(250, 250);
        f.setLocation(300,200);
        f.getContentPane().add(new BorderLayout().CENTER, new JTextArea(10, 40));
        f.setVisible(true);
    }

  • Cannot change command and control button

    in the past I've been able to switch the command and control buttons from system preferences. I recently connected a new Microsoft keyboard to my mac mini, and when I change the command and control button the same way I did before, it has no affect. The command and control keys have their default action. Is there a way to over ride this?

    I did on Lenono brand windows keyboard and it works, but when I try a Microsoft brand windows keyboard, it doesnt work.

  • Cannot change tools and cannot use selection or crop tools

    I am using Photoshop Extended CS6.  A new problem has started to occur recently.  I can select a tool, but I can't change the tool type. For example, I can select the Lasso Tool and when I right-click the tool fly-out appears, but I cannot select a tool from the fly-out to change the tool type.  The editing tools, at least the ones I can select, still work except for the selection and crop tools.  For the crop tool, the crop lines appear at the edge of the image but they cannot be moved.  For the selection tools, nothing is selected.  I can still use menu commands such as Canvas Size.
    This happens when I open a file or start a new file.  I have Windows 7, 4G memory and nothing else running.  I have tried 32-bt and 64-bit versions.
    This has happened intermittently for a month or two.  In the past, freeing up space on a hard drive seemed to help.  But now I have 50G free on one drive and 30G free on another so I don't see how that could be the problem.  Rebooting allows me to use the crop tool once, but then the problem reoccurs.
    Ideas, anyone?

    No keyboard macro programs installed.  Microsoft Security Essentials is installed.  It says it is up to date and there are no problems.  A keyboard test program found no problems. I have tried two USB keyboards with the same results  I have 10% free on my system drive: and 15% free on my second drive.
    More clues:
    If I open Photoshop by opening a file, the problem immediately occurs. If I open Photoshop and then open a file, it works until I press a key as described above.
    The problem only occurs in Photoshop. I’ve tried lots of other programs, including Premiere, Audition and Illustrator; they all work correctly.
    The problem can occur without a keyboard attached.  As I described above, if I switch to another application (Windows Explorer in my test) and then switch back, the problem occurs.  This is true even if there is no internal keyboard and no USB keyboard.

  • Since the latest software update, every third or so time I turn it on, my sounds settings are changed and I cannot listen to anything-music, YouTube, nothing. I can sometimes change something and it will work, but right now nothing is working. Anyone else

    Since latest software update, my sound settings are changing sometimes when I turn on and cannot hear anything. All controls are useless and cannot be activated. After changing several things, I have been able to make it work, but today nothing is working. Anyone else experience this  and have any ideas?

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • Using Elements 7 and cannot change name and email.  Need help

    I am trying to change Photoshop Elements 7 log in name and email and it will not let me do this.  What do I need to do?

    Where are you trying to login?  PSE7 didn't require to login anywhere buy#t if you created a photoshop.com account then it is gone forever.  Instead, Adobe now uses Revel but please tell us where are you trying to login.

  • Cannot change date and time settings, popup "These files can't be opened: Your internet security settings prevented..."

    When I try to change my date and time settings I get a Windows Security popup that reads: "These files can't be opened.  Your Internet security settings prevented one or more files from being opened. C:\Windows\system32\rundll32.exe"
    I have Windows 7 64 bit.  I also have McAfee SecurityCenter installed.  I have tried turning off my firewall temporarily, but the problem persists.  I am not sure if it is some type of virus.  If anyone could give me some information
    as to what could be causing this I would appreciate it.  Thanks in advance.

    Hi,
    Perhaps, this issue is caused by a sign of corruption.
    Please try to use sfc/scannow to check the System Files.
    Also, You may refer to the following link.
    http://www.sevenforums.com/general-discussion/71526-cant-change-date-time-2.html 
    Important Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • [SOLVED]Xorg: cannot change keymap and add multiple langs

    ~/.xinitrc
    setxkbmap -layout gb,dk,lt -option grp:alt_shift_toggle
    I've followed wiki and this didn't change anything. My keymap is currently us and alt+shift change doesn't react.
    Last edited by decas (2014-02-23 18:54:02)

    slithery wrote:Everything following the exec line in a .xinitrc is ignored. Move the exec line to the bottom of the file.
    This.
    decas, read the note https://wiki.archlinux.org/index.php/Xinitrc

  • Cannot change sleep and screen saver

    I do not have File Vault activated.
    I have tried all the usual tricks ( as well as the proper method) but once changed and closed the setting reverts to the original setting.
    I have searched Google and many people are having this problem and no-one in Apple seems to care to resolve this issue.

    Step one is to create a new admin user account, log into it, and see if the problem persists.

Maybe you are looking for