Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:29:32+00:00 2026-05-26T07:29:32+00:00

I want to put an element into another component (in this case a print

  • 0

I want to put an element into another component (in this case a print template), print it, and then return it to its place. The problem is that when I return it, it has the properties of the print template! Here is a simplified example. When you click print, the label is removed and then returned but when returned it is affected by the padding of the print template! Why? How can I somehow refresh it to its proper properties? I tried all the invalidate… methods and parentChanged() but nothing worked.

<?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" width="400" height="200">

    <fx:Script>
        <![CDATA[
            import spark.components.VGroup;
            protected function button1_clickHandler(event:MouseEvent):void {
                var printTemplate:VGroup = new VGroup();
                printTemplate.paddingTop = 50;
                printTemplate.paddingLeft = 30;

                printTemplate.addElement(label);
                addElement(printTemplate);
                validateNow();

                // print

                removeElement(printTemplate);
                addElement(label);
            }

        ]]>
    </fx:Script>

    <s:Button label="Print" right="0" click="button1_clickHandler(event)"/>
    <s:Label id="label" text="This is the label text, it should appear at the top-left."/>

</s:Application>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:29:32+00:00Added an answer on May 26, 2026 at 7:29 am

    OK I hacked up a solution. Put this in before adding the label back to its proper place:

    var vg:VGroup = new VGroup();
    vg.addElement(label);
    addElement(vg);
    validateNow();
    removeElement(vg);
    

    Then it gets the padding from “vg”, which has no padding set. Yay. Another little hack to circumnavigate a Flex bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Zend_Form_Element_Multicheckbox and I want to put some of its elements in
I want to put individual JComboBoxes into each cells of a JTable. ie. The
What I want : To, on focus, change one input box into another by
I want to check branchList whether has same element or not, if same put
Using Mootools, we can inject an element into another element: $('childID').inject($('parentID'), 'top'); The second
I've projected an Intranet Ajax application and I want put it in a full
hey, hi i want put limit on object creation means a class can have
I have a page layout for my MOSS '07 site that I want put
I want to put a copyright notice in the footer of a web site,
I want to put random output from my result set (about 1.5 mil rows)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.