Not centering on stage, why?

Hello again folks. I've come across a new snag to a previous project. I'm not quite sure why, but when the full image is loaded to the stage, it is not centering it properly. The trace of fullLoader returns "0" for the width and height of the full-sized image, and I'm not quite sure how to pass the necessary information into the showPicture function so that it correctly centers the image. I tried tracing the content of fullLoader and got an error message. Any help would be appreciated.
import flash.display.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.filters.*;
var fadeTween:Tween;
var imageLoader:Loader;
var fullLoader:Loader = new Loader;
var xml:XML;
//parse XML data as an array
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
var thumbDShadow:DropShadowFilter = new DropShadowFilter();
thumbDShadow.color = 0x000000;
thumbDShadow.blurX = 10;
thumbDShadow.blurY = 10;
thumbDShadow.distance = 3;
xmlLoader.load(new URLRequest("data/gallery.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void {
    xml = XML(event.target.data);
    //parse the nodes in the XML file
    xmlList = xml.children();
    //count the number of nodes in the XML file via XMLList
    trace(xmlList.length());
    //loop to load all of the thumbnails, based on the number of nodes in XMLList
    for (var i:int = 0; i < xmlList.length(); i++) {
        imageLoader = new Loader();
        imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
        //position of thumbs (horizontally across stage)
        imageLoader.x = i * 110 + 10;//thumbs are 100 x 100 so, +10 to the width, plus +10 from left edge
        imageLoader.y = 10;
        imageLoader.name = xmlList[i].attribute("source");
        imageLoader.filters = [thumbDShadow];
        //add thumbnails to stage
        addChild(imageLoader);
        //set up thumbs to load primary image
        imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
function showPicture(event:MouseEvent):void {
    fullLoader.unload();
    fullLoader.load(new URLRequest(event.target.name));
    //position full image below the row of thumbs and center to stage
    fullLoader.x = (stage.stageWidth - fullLoader.width) * 0.5;
    fullLoader.y = (stage.stageHeight - fullLoader.height) * 0.5;
    addChild(fullLoader);
    fadeTween = new Tween(fullLoader, "alpha", None.easeNone, 0, 1, 0.5, true);
    trace("Stage: " + stage.stageWidth + " wide by " + stage.stageHeight + " tall.");
    trace("FullLoader is: " + fullLoader.width + " wide by " + fullLoader.height + " tall.");

OH! Wow, okay now this makes much more sense now. The amended showPicture function is now:
function showPicture(event:MouseEvent):void {
    fullLoader.unload();
    fullLoader.load(new URLRequest(event.target.name));
    fullLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, addToStage);
    function addToStage(event:Event):void {
        //position full image below the row of thumbs and center to stage
        fullLoader.x = (stage.stageWidth - fullLoader.width) * 0.5;
        fullLoader.y = (stage.stageHeight - fullLoader.height) * 0.5 + 110;
        addChild(fullLoader);
        fadeTween = new Tween(fullLoader, "alpha", None.easeNone, 0, 1, 0.5, true);
        trace("Stage: " + stage.stageWidth + " wide by " + stage.stageHeight + " tall.");
        trace("FullLoader is: " + fullLoader.width + " wide by " + fullLoader.height + " tall.");
AWESOME! Thanks so much for your help!

Similar Messages

  • Why ejb20.DDInit's result put to screen, not to a stage directory

    Hi, I am new in weblogic. I run "java weblogic.ant.taskdefs.ejb20.DDInit stage" to
    automatically create ejb-jar.xml, weblogic-ejb-jar.xml, but it only create one xml
    file and print it to screen, not to the stage/META-INF directory, I have create stage/META-INF
    direcoty and put correct class file under stage directory and set enviroment just
    as the doc(Developing Weblogic Server Applications) describe, I use Weblogic 7.0,
    How to solve this problem?
    And if I use weblogic.marathon.ddinit.EJBInit, it produce no xml file, and display:
    [ModuleInit]: Searching for class files
    [ModuleInit]: 4 classes found
    [ModuleInit]: Discovered module type for E:\java\usingj2ee\pricing\stage
    [ModuleInit]: Found EJB components. Initializing descriptors
    [ModuleInit]: Found EJBHome: usingj2ee.pricing.PricingHome
    [ModuleInit]: Creating relations
    [ModuleInit]:
    Found no EJBs in the specified directory.
    [ModuleInit]:
    Be sure the EJB classes are in the proper package hierarchy under the specified directory
    'E:\java\usingj2ee\pricing\stage.'
    [ModuleInit]: Writing descriptors
    [ModuleInit]: Building module with newly created descriptors
    [ModuleInit]: Finished building module
    [EJBJarCMBean] Writing descriptors
    why?

    You found a bug. I file a bug request: CR080702.
    We will fix it very soon.
    Thanks.
    Cedric
    "Rafe Lin" <[email protected]> wrote in news:[email protected]:
    >
    Hi:
    Now I attach the stage directory and source java file, Thank you.
    Cedric Beust <[email protected]> wrote:
    Please post the updated jar file (preferably with the source files in
    it). Are you sure the XML descritprs are not created inside the jar
    file? The trace seems to say the contrary...
    Cedric
    "Rafe Lin" <[email protected]> wrote in news:3d128fb6
    @newsgroups2.bea.com:
    >>
    >>
    >>>
    Hi, now I rename PringImpl.java to PricingEJB.java, and there is no
    error when DDInit run, but the two xml still not appear, why? when I
    run DDInit, screen display:
    [ModuleInit]: Searching for class files
    [ModuleInit]: 4 classes found
    [ModuleInit]: Discovered module type for
    e:\java\usingj2ee\pricing\stage [ModuleInit]: Found EJB components.
    Initializing descriptors [ModuleInit]: Found EJBHome:
    usingj2ee.pricing.PricingHome [ModuleInit]: Bean class:
    usingj2ee.pricing.PricingEJB [ModuleInit]: Adding Session bean
    'PricingEJB' [ModuleInit]:
    [ModuleInit]: Creating relations
    [ModuleInit]: Writing descriptors
    [ModuleInit]: Building module with newly created descriptors
    [ModuleInit]: Finished building module
    [EJBJarCMBean] Writing descriptors
    Thanks!
    Cedric Beust <[email protected]> wrote:
    "Rafe Lin" <[email protected]> wrote in
    news:[email protected]:
    Hi, now I attach the jar file, of course, I run DDInit before the
    achieve file is created, it just present the stage dir struct, I
    did
    not run DDInit on the jar file. Thanks!Your bean has unusual naming conventions: your bean is called
    PricingImpl.
    Rename it to PricingEJB and DDInit should recognize it.
    Admittedly, EJBInit should do a better job at guessing, or at least at
    producing a better error message.
    CedricAttachment decoded: untitled-2.txt
    ---=_news3d128fb5
    Attachment decoded: Pricing.jar
    ---=_news3d128fb5--Attachment decoded: untitled-2.txt
    ---=_news3d145663
    Attachment decoded: for_chk.jar
    ---=_news3d145663--

  • Why war.DDInit's result put to screen, not to a stage directory

              Hi, I am new in weblogic. I run "java weblogic.ant.taskdefs.war.DDInit stage" to automatically
              create web.xml & weblogic.xml, but it only create one xml file and print it to screen,
              not to the stage/WEB-INF directory, I have create stage/WEB-INF direcoty and put
              jsp file under stage directory and set enviroment just as the doc(Developing Weblogic
              Server Applications) describe, I use Weblogic 7.0, How to solve this problem?
              

              Hi, I use the absolute directory "c:\stage" instead of relative directory "stage",
              but it still not work.
              "ludovic le goff" <[email protected]> wrote:
              >Hello Rafe,
              >
              >In my opinion, there is maybe a mistake in your java command line.
              >As described at this link :
              >http://e-docs.bea.com/wls/docs70/programming/packaging.html#1068003, the
              >staging-dir parameter is a directory.
              >I would suggest to type the following java command instead of yours (
              >assuming that you put the stage directory in the C drive ) :
              >- java weblogic.ant.taskdefs.war.DDInit c:\stage
              >
              >I hope this helps.
              >Best regards,
              >Ludovic.
              >Developer Relations Engineer
              >BEA Customer support
              >"rafe lin" <[email protected]> a écrit dans le message news:
              >3d0d5f77$[email protected]..
              >>
              >> Hi, I am new in weblogic. I run "java weblogic.ant.taskdefs.war.DDInit
              >stage" to automatically
              >> create web.xml & weblogic.xml, but it only create one xml file and print
              >it to screen,
              >> not to the stage/WEB-INF directory, I have create stage/WEB-INF direcoty
              >and put
              >> jsp file under stage directory and set enviroment just as the
              >doc(Developing Weblogic
              >> Server Applications) describe, I use Weblogic 7.0, How to solve this
              >problem?
              >
              >
              

  • JDIalog, HTML Code, setLocationRelativeTo; not centered

    Hi,
    I am building my own modal dialog; it's a JLabel with formatted HTML Code - I only use the bold <b> and break <br> tag in the default font size and -type.
    I use setLocationRelativeTo() to center the dialog to my main JFrame; however, the dialog is not centered, it's shifted down to the right. Even if I just use some letters in my HTML code the dialog isn't centered. Here is my code:
    public class TDDialog extends JDialog implements ActionListener, WindowListener {
         private JPanel exercisePanel, containerPanel;
         private JLabel exerciseLabel;
         private JButton readyButton = new JButton("Ready");
         private JButton showSolutionButton = new JButton("Solution");
         private JTextField solutionTextfield;
         private String solutionString;
         private Font font = new Font("SansSerif", Font.PLAIN, 12);
         public TDDialog(Frame ownerFrame) {
              super(ownerFrame, true);
              addWindowListener(this);
              setTitle("Exercise");
              setLayout(new BorderLayout());
              exerciseLabel = new JLabel();
              exerciseLabel.setFont(font);
              exercisePanel = new JPanel();
              exercisePanel.add(exerciseLabel);
              solutionTextfield = new JTextField();
              solutionTextfield.addActionListener(this);
              containerPanel = new JPanel();
              containerPanel.setLayout(new BorderLayout());
              containerPanel.add(readyButton, BorderLayout.LINE_START);
              containerPanel.add(showSolutionButton, BorderLayout.CENTER);
              readyButton.setFont(font);
              showSolutionButton.setFont(font);
              readyButton.addActionListener(this);
              showSolutionButton.addActionListener(this);
              exerciseLabel.setText("<html><body>3 Lines<br><b>3 Lines</b><br>3 Lines<br></body></html>");
              add(exercisePanel, BorderLayout.PAGE_START);
              add(solutionTextfield, BorderLayout.CENTER);
              add(containerPanel, BorderLayout.PAGE_END);
              setResizable(false);
              pack();
              setLocationRelativeTo(ownerFrame);
              setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    // action- and window-listeners...Am I building the JDialog correctly? Is there a better, a more recommended or "nicer" way? Why isn't hte dialog centered?
    Edit: I really would like to assign Duke Stars to my question, however, since the last forum maintenance, I can't do this any more "Server Error
    This server has encountered an internal error which prevents it from fulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log." This happens every time at different PCs with different browsers / versions / proxy-settings.
    Message was edited by:
    SFL

    Here is the missing part for a SSCCE; I noticed that the modal dialog is centered in relation to the screen, not to the "ownerFrame", although I pass ownerFrame to the setRelativeTo statement.
    import java.awt.Dimension;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class GUI_Test extends JComponent implements MouseListener {
         private static final long serialVersionUID = 1L;
         private JPanel pmPanel = new JPanel();
         private TDDialog tdd = new TDDialog(GUI_Test.frame);
         private static JFrame frame;
         public GUI_Test() {
              addMouseListener(this);
              add(pmPanel);
         private static void createAndShowGUI() {
              JFrame.setDefaultLookAndFeelDecorated(true);
              frame = new JFrame();
              frame.setTitle("GUI_Test");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              GUI_Test newContentPane = new GUI_Test();
              newContentPane.setOpaque(true);
              frame.setPreferredSize(new Dimension(500, 500));
              frame.setResizable(false);
              frame.setContentPane(newContentPane);
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        createAndShowGUI();
         public void mouseClicked(MouseEvent arg0) {
              tdd.setVisible(true);
         public void mouseEntered(MouseEvent arg0) {}
         public void mouseExited(MouseEvent arg0) {}
         public void mousePressed(MouseEvent arg0) {}
         public void mouseReleased(MouseEvent arg0) {}
    }Thanks for your help!

  • Pix are not centered when i print . tryed everything i kow to fix problem, help me please

    Like I said (re-above) I can't fix or figure out why my pix are printing out not centered on paper .. I tryed everything that I know and it's starting to cost to much to just print pix and keep getting the same result . Please Help me if you can. Thank
    you.

    What printer are you using?
    What OS are you using?
    What program are you using to print?
    What kind of paper are you printing on?
    How is the printer connected to the computer?
    HP designed a quick and easy tool that diagnoses and resolves many printing, scanning, and connectivity problems: The HP Print and Scan Doctor. HP recommends that you download and install the Print and Scan Doctor any time you need to troubleshoot a problem with your HP printer from the link below.
    Let me know what errors you receive?
    HP Printer Utilities Page
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • Deliveries not assigned to stages in shipment

    Hi,
    For the outbound deliveries,Shipments will create via batchjob ( VT04-). After creating shipments, the DN's should assign to each stage in shipment document. But it is not assigned to the all stages. ( we have 4 stages in route & DN is assigned to only 3 stages but not for 4th stage  )
    can you please through some light on this? why its behaving like this?
    what is the logic at the time of the leg determination?
    -*All replies rewarded.

    Dear RMD
    May be this link will be of helpful to you.
    http://help.sap.com/saphelp_47x200/helpdata/en/93/743f27546011d1a7020000e829fd11/frameset.htm
    Thanks
    G. Lakshmipathi

  • Poster image not centering in browser

    My poster image (for viewing in IE8) is not centering in the browser window. It's displaying as left aligned with a big gap to the right of the image. How do I fix?

    Thank you Hemanth, that is exactly what I am referring to. One final question though, as I am by no means an HTML guru...do I add the snippet while I'm in Edge or do I open the HTML file in Dreamweaver and add the code there?
    If in Edge, where do I access the code to add it (and where does it go)?
    If in Dreamweaver...here is the code for my file, where  would I place the snippet?
    <!DOCTYPE html>
    <html>
    <head>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
              <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
              <title>Untitled</title>
    <!--Adobe Edge Runtime-->
        <script type="text/javascript" charset="utf-8" src="FEA2014_Invite_edgePreload.js"></script>
        <style>
            .edgeLoad-EDGE-450331542 { visibility:hidden; }
        body {
              background-color: #000000;
        </style>
    <!--Adobe Edge Runtime End-->
    </head>
    <body style="margin:0;padding:0;">
              <div id="Stage" class="EDGE-450331542">
              </div>
    </body>
    </html>
    I GREATLY appreciate this advice!
    Many thanks,
    James

  • In iCal - I keep getting the error message " This calendar was created by Mail" and it will not accept any input; why..??

    In iCal - I keep getting the error message “ This calendar was created by Mail” and it will not accept any input; why..??

    use Disk Utility and Verify Permisions then fix and Verify Disk and fix, this should fix it.

  • My apple id is not working in itunes. why?

    my apple id is not working in itunes. why?

    LeesaHeeley wrote:
    When I go to settings/iTunes App Store my Apple ID is not there. When I enter my ID and password it does not save or link to account.
    When fist setting up your new iphone you will be asked to log in with an apple id and password. If this did not happen you can then do as you suggested going to settings to itunes and app store and add your apple id login. This apple id login must have already been created for the iphone to accept it. If this apple id is already created but is not being accepted by your iphone you then should shut down your iphone and restart the device.
    Good luck.

  • I want to email a Pages document as a Word doc. I used to be able to do this by clicking on share then send via mail then on Word and an email would appear with my word doc attached.  Now the email does not come up.  Why?

    I want to email a Pages document as a Word doc. I used to be able to do this by clicking on 'share' then 'send via mail' then on 'Word' and an email would appear with my word doc attached.  Now the email does not come up.  Why?

    It's difficult to do more than guess when you don't say what version of OS X or Pages you're running, but if you're on the latest, have you tried the Share menu -> Send via Mail command?
    If that doesn't help, you may have better luck if you ask in the Pages forum:
    Pages
    When you repost, be sure to include full details about your versions so that people know what it is you're working with.
    Regards.

  • Hello, i use premiere pro cc and i would like to uplaod my sequence in speedgrade with direct link but it's not available. I can see the option but it's not clickable, somebody knows why ?

    Hello, i use premiere pro cc and i would like to upload my sequence in speedgrade with direct link but it's not available. I can see the option but it's not clickable, somebody knows why ?

    Oh i'm not sure they are on same, i downloaded speedgrade this morning and i didn't upgraded premiere so it's maybe this ! thanks i will try it and let you know

  • 5th generation ipod is not recognized by itunes, why?

    5th generartion ipod is not recognized by itunes, why it this?
    thank you.

    See:
    iOS: Device not recognized in iTunes for Windows
    I would start with:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    If it does not charge
    - Try another cable. Some 5G iPods were shipped with Lightning cable that were either initially defective or failed after short use.

  • My external Iomega DVD drive does not read DVDs. Why?

    My external Iomega DVD drive does not read DVDs. Why?

    what does this question have to do with a mac?  post in the Iomega fourms.

  • I received an error "iTunes requires 64-bit mode" says to go into my iTunes application and 'uncheck' the 'open in 32-bit mode' checkbox - i went into the application and the box was not checked anyway so why am i getting this prompt?  Never happened b4

    i received an error message "iTunes requires 64-bit mode" says to go into my iTunes application and 'uncheck' the 'open in 32-bit mode' checkbox - i went into the application and the box was not checked anyway so why am i getting this prompt?  Never happened before. yesterday did the sofware update for maverick.

    Thank you for your response, Chris. But I'm afraid I have to disagree. There are native 64 bit versions of iTunes available for OSX and Windows.
    In a 64 Bit Windows environment native 64 Bit Applications install the DLL's in a directory called "Program Files" and a directory called "Program Files (x86)" (32 Bit applications only use the ladder).
    iTunes 9 is consistent with this behavior - and it identified itself to the system as a 64 bit application (meaning it's process appears without a "*32" tag on it).

  • I am having trouble downloading purchased songs to my iphone.  I keep getting an error message that the song could not be downloaded.  Why?  How do I fix this?

    I am having trouble downloading purchased songs to my iphone.  I keep getting an error message that the song could not be downloaded.  Why?  How do I fix this?

    Hello Dawnellk,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/ht2519
    Previous purchases may be unavailable if they have been refunded or are no longer on the iTunes Store.
    Best of luck,
    Mario

Maybe you are looking for

  • Needs a background webdynpro application running at the server side

    Hi All, We have a requirement wherein we need to have an application running all the time at the server side to capture the response coming from a web application. Based on the response that the application receives, it needs to update some backend R

  • How to change an approver in shopping cart( by function module ) ?

    Hello, i wish to change my approver ( not through the portal) but by function module ( or some other way) .  Then, the creator of the SC will see the new approver in his cart details and also, when the new approver logs in, he will have the shopping

  • Swf-version can be specified when using SDK 3.6? [ Error #1065: Variable JSON is not defined ]

    I've been using playerglobal.swc of flash player 11 and SDK 3.6. ReferenceError: Error #1065: Variable JSON is not defined can be solved by setting -swf-version to 13. (http://forums.adobe.com/message/3933620#3933620) However, swf-version is not avai

  • Flowing images/text?

    I am using InDesign CS5.5 and need to flow multiple images into pre-designed frames and names into pre-designed text boxes under each frame.  I have looked at data merge, anchoring, etc, but haven't found anything that will do exactly what I need ...

  • FileVault doesn't log me automatically in after Migration Assistant

    I've got a new MacBook Pro with Retina Display with Mavericks which initially I just setup without transfering information. Then I enabled FileVault. After restarting the EFI asks for my password to unlock the drive and then automatically logs me in.