Custom button that creates another object in its parent

I have a function that creates an instance of a custom class that extends of button inside a BorderContainer using MyBorderContainer.addElement ().  It seems to work very well.  What I would like is for the custom button (which it will be several created) in order to create a panel inside the same BorderContainer.  This is the class for the custom button:

[quote] / public class MySpecialButton extends button

{

private var NewPanel:Panel = new Panel();

public void MySpecialButton()

{

this.setStyle ("skinClass", MySpecialButtonSkin);

}

override the clickHandler(event:MouseEvent):void function

{

this.parent.addChild (NewPanel);

}

} [/ quote]

I get no errors or warnings, it just seems to get hung on the line, addChild.  I worked on this problem for a while now and I'm stuck.  Any ideas?

I think the parent panel should be responsible for adding the new Panel.  And also, why you override clickHandler?  Try to take responsibility for adding children to the parent of the key and try to add the parent of ITTO.  Here is some pseudo-code of what I speak.

public function buttonClicked (event: Event): void

{

var newPanel:NewPanel = new NewPanel();

addElement (newPanel);

}

.....

Sincerely,

Ubu

Tags: Flex

Similar Questions

  • How can I design a custom button that has three lines of text in the button itself?

    A matter of design, which is a good implementation of the following? I need to create a custom button that looks like:

     -----------
    | Header    |
    | Subheader |
    | Text      |
     -----------
    

    I know that I can not add a VerticalFieldManager or add any field of a ButtonField, but if I create a custom, button how I would create three lines of text similar to having three LabelFields lined up in a VerticalFieldManager?

    Thank you.

    You can create a focusable multiline field label creation with the bit style FOCUSABLE and with newline characters in its text. It is possible to work a bit like a button field (substitute navigationClick / navigationUnclick to perform the action or, better yet, to call fieldChangeNotify so that you can plug into the field with a FieldChangeListener).

    Use RichTextField rather than LabelField if you want to play with fonts (say, "BOLD" underlined header; italic subheader; normal text).

    If you want rounded corners and other effects, override the paintBackground method or painting of the field (don't forget to call the super.paint, if you go with the latter).

    That being said - that there is no single best design, so feel free to browse the forums (research of "multiline" or "multiline" yields quite a few results) and come up with your own ideas.

  • Make a button to rotate another object

    How can I make a button turn another object, as follows:

    There is an object, the button and the input field:

    When I put the number 1 in the text entry fieldand then click on the button, I want to rotate the object 90 degrees.

    How can I do this using ActionScript 3.0 and Adobe Flash Professional CS5?

    Make sure your textfield is the only line, no not compatible html and has not activated the kerning.

    If you still have problems using the trace() function to check the textfields text and the length of the text.

  • Custom button that displays the operating range

    I have created an indicator button for a controller of pan/tilt. It has two needles. It indicates the current position of the Pan and the other the position of the unit was ordered to kill. In addition, I want to set limits of pan that will display on the indicator, as a colored strip between the start and end limit. The range may include zero - that is a legal range could be from 320 degrees to 15 degrees. Any ideas on how to proceed?

    Hello,

    You want certainly is possible using the colorimetric scale integrated and property [] MarkerVals-you just need to follow or not your valid range through 360 degrees and to update her varies as appropriate.

  • Is it possible to create an action that moves an object?

    Is it possible to create an action that moves an object from its original position to another location?

    I think you can do it using the object effects.

  • I need to find the source file or registry that creates "Services" Exceptions in the firewall of Windows XP when the system is restarted.

    I have a boot sector virus (Troj/MBroot-H) that I can not remove from my computer without losing access to my HARD drive due to a custom boot partition.  I can't afford to repair or replace the computer I have at the moment, so I try to disable things as much as possible to neutralize this virus.  I have already downloaded Malwarebytes and analysis had revealed 18 registry viruses and files that have already been removed from the system.  The HelpAssistant account and its files have been deleted from the system.

    The only thing left to change is the firewall of Windows XP.  I currently have to restore Windows Firewall to its settings by default whenever I restart my computer because the virus has configured the system to add more 'services' and 'management' objects in the list of Exceptions whenever the system is restarted.  If I don't do that an outside source will invade the system via remote desktop and add the HelpAssistant account and the file.  I need to know how to replace system orders that creates these objects for additional exceptions during the restart.  I want to restore full contol on the firewall of Windows XP by allowing not exceptions except those I choose.  Is there a Window XP Firewall registry key or file that can be removed, replaced or changed to keep these elements to be added to the list of exceptions?

    Thank you

    Spacejunkie1

    The computer is still severely infected and you will not be able to "establish complete control over the firewall of Windows XP". Backup your data and do a clean install of Windows. I understand that you do not want to hear this, but it is, IMO, the answer. Please specify your first sentence if you need assistance.

    http://michaelstevenstech.com/cleanxpinstall.html - Clean install - how-to
    http://www.elephantboycomputers.com/page2.html#Reinstalling_Windows - what you will need at hand

    MS - MVP - Elephant Boy computers - don't panic!

  • Custom button Fields/OutofMemory errors/slow down the loading time of bitmap

    I followed the example of button custom rim and made about custom button bitmap 40.  I find the loading screens with these buttons to be VERY VERY VERY slow and I have random errors especially outofmemory which I think may be related to the amount of custom button that I use.  He doesn't do everything for me at all as the bitmap files being about 3.5 K.  40 * 3.5 = 140 K that is nothing compared to the opening of an image file.

    The storm could really be chokeing on 140K of custom bitmap buttons?  Someone at - it experience with the fields of button custom bitmap?

    Have you thought about making your static Bitmaps, so you load only once?  In fact if you reuse them on several screens, I suspect their sharing could save you a bit of storage too.  Create a public static instance in a shared class and load them once.  Just a thought.

  • Paint custom button problem

    Hi, I have a custom button that must be next to a labelfield.

    The paint of the button code is:

     protected void paint(Graphics graphics) {
    
       graphics.drawBitmap(13, 0, fieldWidth, fieldHeight, button, 0, 0,);
    
    }
    

    Where '13' is the space between labelfield and button. But when the font size is larger, the result is the following: [IMG]http://i34.tinypic.com/xeq2hu.jpg[line]

    The button is cut off and other times, its even more. What could be a solution?

    Thanks in advance.

    A HorizontalFieldManager defines the fields from left to right, it only wraps to the next line.  You can use a FlowFieldManager to achieve that has the fields from left to right, then on the next line below.

  • How the States of buttons would create for MCs I create abstract MCs

    I'm creating a generic site would have MCs abstract which loading jpg or TXT fields for the user interface allow quick updates of the site. The MCs, which would make the user interface would be empty and load using XML or PHP things later. How to create buttons for the MCs user interface States.  I started to create a function for each State of the MC button, but I thought that it might be a more effective way.

    creating a table would allow it in this case?

    and URLRequest using the means of links to pages with a good flash animation film which is the site it's me?

    / * - THE BEGINNING OF MY ACTION SCRIPT-* /.

    var waywardLogo_mc:MovieClip = new MovieClip;

    var theCollection_mc:MovieClip = new MovieClip;

    var newsPage_mc:MovieClip = new MovieClip;

    var whatthe#$@!doyouwant! _mc:MovieClip = new MovieClip;

    /*---------------------------- onOver ------------------------------*/

    waywardLogo_mc.addEventListener (MouseEvent.ROLL_OVER, onOver);

    theCollection_mc.addEventListener (MouseEvent.ROLL_OVER, onOver);

    newspage_mc.addEventListener (MouseEvent.ROLL_OVER, onOver);

    Whatthe#$@!doyouwant! _mc.addEventListener (MouseEvent.ROLL_OVER, onOver);

    /*---------------------------- onOut ------------------------------*/

    waywardLogo_mc.addEventListener (MouseEvent.ROLL_OUT, onOut);

    theCollection_mc.addEventListener (MouseEvent.ROLL_OUT, onOut);

    newspage_mc.addEventListener (MouseEvent.ROLL_OUT, onOut);

    Whatthe#$@!doyouwant! _mc.addEventListener (MouseEvent.ROLL_OUT, onOut);

    /*---------------------------- onClick ------------------------------*/

    waywardLogo_mc.addEventListener (MouseEvent.CLICK, onClick);

    theCollection_mc.addEventListener (MouseEvent.CLICK, onClick);

    newspage_mc.addEventListener (MouseEvent.Click, OnClick);

    Whatthe#$@!doyouwant! _mc.addEventListener (MouseEvent.Click, OnClick);

    function onOver(event:MouseEvent):void

    {

    Event.Target.alpha =. 5;

    }

    function onOut(event:MouseEvent):void

    {

    Event.Target.alpha = 1;

    }

    function onClick(event:MouseEvent):void

    {

    event.target.URLRequest("");

    }

    / * - onover, procedure, onClick buttonModes-* /.

    waywardLogo_mc.buttonMode = true;

    theCollection_mc.buttonMode = true;

    newspage_mc.buttonMode = true;

    Whatthe#$@!doyouwant! _mc.buttonMode = true;

    Click on insert/new symbol tick movieclip, name, export of ticks for actionscript and the textfield class, enter a name (say ButtonClass) and click ok.

    Strip attached to the first frame of your new movieclip type stop() in Control Panel actions.  put any graphic you want on stage for your scene button.  create another keyframe, label it 'over' and put some graphic for button on desired state on stage.

    in a layer on top of these graphics, you probably want to add a dynamic textfield so that each button of your different text can be.  Name textfield and instance (say tf) and extend his screenplay to the last frame of your movieclip button.

    Then, when you want to create a button on your timeline that you can use:

    var b:ButtonClass = new ButtonClass();  These two lines must be entered for each button

    buttonhandlerF (b, someX, someY);

    -the code between dotted lines must only be paid once little matter how many buttons that you add.

    function buttonhandlerF (x: Number, y: Number, b:ButtonClass) {}

    b.addEventListener (MouseEvent.MOUSE_OVER, overF);

    b.addEventListener (MouseEVent.MOUSE_OUT, outF);

    b.x = x

    b.y = y

    addChild (b);

    }

    function overF(e:MouseEvent) {}

    e.currentTarget.gotoAndStop ("over");

    }

    function outF(e:MouseEvent) {}

    e.currentTarget.gotoAndStop (1);

    }

    -the code between dotted lines must only be entered only a time-

    you will also need to create a click listener and listener function

    /////////////////////////////////////////////

    the code between the dotted lines ready to be added to a class of ButtonClass.as if file want to expand your capabilities.

  • Custom button keyboard

    I made a custom button that looks like a button on a computer keyboard.  When not selected it seems to be raised and that selected it seems lowered.  The question I have is when picked up and down key change so it is lowered to the axis ot the button and I want to be pressed to the bottom of the image.  How can I get there?

    Thanks for the help!

    Hey,.

    I think you are looking for something like this?
    (See attachment)

    You can edit it as a custom control. Open the custom control and type Customize mode, right click the button and check the option "size independent. This let's customize you the on and off State State separately.

    You can select individual States again right click and "elements of the image."

    When the button is 'up', I left the control being, when the button is 'down' I moved this State so that the base was at the same level as the base of the State 'up', leading to the illusion of a keyboard button.

    I hope I explained that well enough and it helps!

  • Custom button on a touch paint problem

    I have a custom button that I use to the pop-up window of a PopupScreen. The custom button has his own painting methods (he also replaces the applyTheme() method), and for the most part, everything works as expected.

    The only problem I have is when the button is pressed. If I press and hold the button, the button is redrawn with what seems to be the default paint scheme (it seems that it is painted without label as well). As soon as I release the button and the context menu is displayed, the button is redrawn with my custom methods and look as I hope.

    Suggestions appreciated, thanks!

    If navigationClick is treated by default? This is the root of the problem: I think that integrated ButtonField.navigationClick defines the Visual status of the "active" field Replace to do what you want it to do and do not call super.navigationClick (well, call of may when the status parameter is not 0 - in the case of Alt-click and make shift-click - and you don't want to deal with yourself).

  • Creating a button that highlights himself and another object

    Hi all

    I have a specific function, I am applying for my InDesign document for export to interactive PDF and SWF/html format.
    The function that I am creating is:
    I have a picture of a typical WYSIWYG toolbar. I created highlight buttons that sit on top of each icon in the image. When the reader hovers over this image of an icon (with the cursor) I want it highlight and also a piece of text lower on the page to highlight as well (which is a definition and an explanation of the icon). So I want the reversal of my first button action to also trigger another action, which is to highlight a piece of text somewhere else on the page. I managed to get so I put the cursor on the first button (icon image), it highlights, and the text below the page. But this isn't quite what I want. I want the text already exists, then highlight. Basically I want the two buttons to be connected. So that whenever I have fly over a part of the image of a created button, it will highlight, and a piece of exploratory text highlight simultaneously elsewhere on the page. A bit like an infographic. It is surely possible?

    Thanks in advance for your help.

    Generally, the animations as this is to export a SWF file are better be done in Adobe Flash.

    In Indesign that kind of market, too. Only for export as SWF, you can assign to the action "go to the State." For a text block, you can assign different status, where the 1st State would be 'normal' and the 2nd status would be "highlighted". Highlighted applies to the object "text frame", so that you can assign a contour or background. Better than nothing.

    Example: Dropbox - test_highlight.indd

  • Create a custom buttons in Windows Explorer to the default directory

    In the Windows XP Explorer: is there a way to create a custom button so that no matter where you are in a different drive, directory and subdirectory... all you have to do is click on the custom button and return to your default directory?  If this is not the case, is a custom button another way to do it.  Currently, I click on the [Back] button or use the button [Back] drop down to return to the default value.  Ok, but not really okay because it takes a click and return to the default value.

    Thank you

    Steven

    Hi Steven Geib,

    Unfortunately, the service back to the default directory is not present in Windows, and as it is a design, there is nothing we can do from our end.

    If you want to suggest changes in the design here is the link you can make reference to: return products.

    http://mymfe.Microsoft.com/Windows%207/feedback.aspx?formid=195

    As an alternative, you can use the tree view in Windows Explorer instead of back to the desired location in windows Explorer.

    Thank you, and in what concerns:
    I. Suuresh Kumar - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • With the help of several classes and create an object of a class and calling its method in a different class.

    Creating a new class, I need to move my main method class SaveDate DynamicTest class. Below I've listed the code of both classes. The goal is to be able to run my class DynamicTest program. I need help to understand the process of moving my main method of a different class and creating an object of a class and calling its method.

    public class {SaveData

    private public static final map < String, Object > myCachedTreeMap = new TreeMap < String, Object > ();

    public static final List < String > getLines (final String resourceParam, final Charset charset) throws IOException {}

    System.out.println ("please:" + resourceParam);

    If {(myCachedTreeMap.containsKey (resourceParam))

    Use the file cached, to avoid a further reading.

    System.out.println ("found in memory:" + resourceParam);

    }

    else {}

    Load the file from the disk

    System.out.println ("found in memory:" + resourceParam);

    }

    Returns a null value.

    }

    Public Shared Sub main (String [] args) throws IOException {}

    String target_dir = "C:\\myfiles\\config\\en";

    Line = "C:\\myfiles\\config\\en\\output.txt";

    File dir = new File (target_dir);

    File files [] = dir.listFiles ();

    If (file == null: files.length < 1) {}

    System.out.println ("file list is empty...");

    return;

    }

    Open the Printwriter

    PrintWriter OutputStream = new PrintWriter (output);

    try {}

    for (textFile file: files) {}

    If (textFile.isFile () & & textFile.getName () .endsWith (".txt")) {}

    readFromDisk (textFile);

    }

    }

    }

    {Finally

    outputStream.close ();

    }

    String fileNameFromCache = "en_synonyms.txt";

    Sheet1 = myCachedTreeMap.get (fileNameFromCache) object;

    System.out.println (fileNameFromCache + ": \n" + "Sheet1");

    }

    @SuppressWarnings ("resource")

    private static Sub readFromDisk(File textFile) throws FileNotFoundException, IOException {}

    BufferedReader InputStream;

    inputStream = null;

    String content = "";

    try {}

    inputStream = new BufferedReader (new FileReader (textFile));

    content = readFile (textFile);

    System.out.println ("bytes read =" + content.length ());

    Save the content

    FileContentsObject Sheet1 = new FileContentsObject (System.currentTimeMillis (),

    textFile.lastModified (), content,

    textFile.getName (),

    getLines (null, null));

    Add to the map

    myCachedTreeMap.put (textFile.getName (), Sheet1);

    }

    {Finally

    If (inputStream! = null) {}

    inputStream.close ();

    }

    }

    }

    private static String readFile(File f) throws FileNotFoundException, IOException, UnsupportedEncodingException {}

    Text of StringBuilder = new StringBuilder (1024);

    read int, N = 1024 * 1024;

    char [] buffer = new char [N];

    BufferedReader br = null;

    try {}

    BR = new BufferedReader)

    (new) InputStreamReader

    (new FileInputStream (f), 'UTF8'));

    While (true) {}

    read = br.read (buffer, 0, N);

    If (read > 0)

    Text.Append (new String (buffer, 0, read));

    if(Read < N) {}

    break;

    }

    }

    }

    {Finally

    If (br! = null)

    Br. Close();

    }

    Return text.toString ();

    }

    private static final class FileContentsObject {}

    private long cachedTime; currentTime

    private long lastModifiedTimestamp;

    private string content

    List < String > lines;

    private String fileName;

    public FileContentsObject (long cachedTime, long lastModifiedTimestamp,

    Content string, String fileName, List < String > lines) {}

    this.cachedTime = cachedTime;

    this.lastModifiedTimestamp = lastModifiedTimestamp;

    This.contents = content;

    this.fileName = filename;

    This.Lines = lines;

    SimpleDateFormat sdf = new SimpleDateFormat ("MM/dd/yy hh: mm :"); ")

    System.out.println ("time & Date:" + sdf.format (cachedTime));

    System.out.println ("' last modification timestamp:" ")

    + sdf.format (lastModifiedTimestamp));

    }

    /**

    *

    * @return the lines of the file

    */

    List < String > getLines() {}

    Return this.lines;

    }

    public String toString() {}

    "return"Sheet1 {}"+" fileName =' ' + filename + '------"+", content = "" "

    + content + "\"+ ", lastModifiedTimestamp ="

    + lastModifiedTimestamp + ', CurrentTime & Date ='

    {+ cachedTime + '}';

    }

    }

    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    public class DynamicTest {}

    Public Shared Sub main (String [] args) {}

    Game characters charset = Charset.forName("UTF-8");

    try {}

    List < String > = CacheData.getLines lines ("en_synonyms", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    try {}

    List < String > = CacheData.getLines lines ("en_stopwords", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    }

    }

    I have read and watched videos about the creation of an object of a class and calling its method in a different class. I'm still confused on how to do it properly. By using the code below if someone can explain how to properly call the method of objects from my hand.

    Huh? You have NOT posted any 'hand' or any 'method of objects '.

    If you need help with the code, you need to view the code.

    The Java tutorials has dozens of trails "Classes and objects": what they are, how to create and how to use them.

    https://docs.Oracle.com/javase/tutorial/Java/javaOO/classes.html

    1. create an instance of a class

    2. call to one or more of the public methods of this class

    If the class has public static methods, you don't need to create an instance first.

    I suggest that you work your way through these tutorials. They include the WORKING example code.

  • How to create a button that is persistent on the top of the Gallery HTML page

    Hello

    My InDesign folio, I have an article with photo gallery full HTML page. The photo grid occupies the full screen. I want to create a button that is persistent on top of this gallery, which the user can type to go to the main Menu page. This button is always visible in one place, even as the user scrolls up and down the gallery. I tried to create it on the top layer and the upper layer of the page master, but the button disapperas loading the HTML gallery.
    If the user does not see any button to navigate through the Gallery to another article.

    Any ideas how to create persistent button?

    Thanks in advance.

    -MP

    Why not do things just like an HTML article? You do it in the Muse.

Maybe you are looking for