Add TextField or label of Sprite

Hey guys and girls,

I have a permanentSprite, this Sprite I add a Bitmap, after I add multiple labels or TextFields. I turn on the standing sprite's buttonMode so I can click on it. But when my mouse goes on the label or TextField, the mouse cursor changes, including at - it a method or function that prevents the interaction of the mouse to the TextFields or labels so that the mouse pointer (the little hand) do not change.

Concerning

Try to set the property of the sprite mouseChildren standing false...

Standing.mouseChildren = false;

Tags: Adobe Animate

Similar Questions

  • Add TextField by pressing the return key content

    Hello

    I would like to know if there is, okay, there is certainly a way, to add TextField content to a list by pressing keyboards return button/key. So far, I use a button 'Add' but this feels kind of stupid to enter text and to confirm twice (key first, then return the Add button) to add it to the list.

    Thanks in advance

    Use the properties of your TextField. for example:

    // Default empty project template
    import bb.cascades 1.0
    
    // creates one page with a label
    Page {
        Container {
            layout: DockLayout {}
            TextField {
                id:myText
                input {
                    onSubmitted: {
                        myLabel.text = myText.text
                    }
                }
    
            }
            Label {
                id: myLabel
                text: qsTr("Hello World")
                textStyle.base: SystemDefaults.TextStyles.BigText
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Center
            }
        }
    
  • Cannot add container to the 2nd Sprite

    Is it possible to add UIComponents to a separate sprite of the main sprite?

    for example, I popup that is just a sprite added ontop of the sprite on the stage.

    I don't get any errors, he just pretended that they aren't there. Here is a code for an example:

    package
    {
        import flash.display.Sprite;
        import qnx.ui.core.*;
    
        [SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
        public class Example extends Sprite
        {
            public function Example()
            {
    
                super();
                //put in a popup
                this.addChild(new popup());
    
            }
        }
    }
    
    package
    {
        import flash.display.Shape;
        import flash.display.Sprite;
    
        import qnx.ui.core.*;
    
        public class popup extends Sprite {
            public function popup(){
    
                super();
    
                // make a background for the popup
                var shape:Shape;
                shape = new Shape();
                shape.graphics.beginFill(0x000000,0.9);
                shape.graphics.drawRect(0,0,600,300);
                shape.graphics.endFill();
                this.addChild(shape);
    
                //add a container to the popup
                var myMain:Container = new Container();
                myMain.margins = Vector.([50,60,50,60]);
                myMain.flow = ContainerFlow.HORIZONTAL;
                myMain.debugColor = 0xFFCC00;
    
                this.addChild(myMain);
            }
        }
    
    }
    

    Add at the end of your popup code:

    myMain.setSize(600, 300);
    

    to force the layout to update and to your container will be displayed.

    Default x and y are 0, so they did not need to be set unless you need to change the position.

  • Is it possible to add additional color labels?

    Currently in Lightroom it seems only 5 color choices for the tagging of photos. I have group photos using color labels, but I often have more than 5 groups (eg. panoramas), and I find the star systems not suitable for this purpose. Is there a way to add additional color labels to the existing group?

    Not really.

    There are essentially five colors. BUT you can add different names for examples, see metadata > color label set > Edit... You might have a set for use with panoramas, one for the HDR, etc.. But a picture can have that ONE label at a time.

    A MUCH more flexible and scalable system is to use keywords for the same info, like Photo > Panorama and Photo > HDR and Photo > support, etc. You will not see a color in the grid, but the list of keywords makes it easy to do what you want. Photos may contain a number of keywords, so you can have the two 'To Do' as a keyword and "print" or something else.

  • Add space to 'Label' in a graph

    The labels in my chart are too close to the base line. I can't understand how to add space through so I thought that I could add a space behind the label formatting. Someone at - he tried this or know how to operate?

    Here's the code.

    < label >

    < xsl: value-of select = "Book/name" / >

    < / label >

    I found how to do this

      

    .

  • Add textfield of a table more simple text to an another textfield in a table

    I have two tables with dynamic textfields within them. What I want to do is to put the text to a textfield in the first table plus a simple text in second table textfield.

    Example:

    var array1:Array = new Array();

    var array2:Array = new Array();


    var mytext1:TextField = new TextField();

    var mytext2:TextField = new TextField();

    mytext2 = "to see";

    array array1 [0] = mytext1;

    array2 [0] = mytext2;




    array array1 [0] .text = array2 [0] .text + 'hello '.


    trace (array1 [0] .text);



    I think that this would be the trace:

    Goodbye Hello



    But instead, he traces the lines different:

    Good bye

    Hello





    Thanks in advance.

    I found what is causing the problem. His mytext2 being multi-line textfield. When I made single-line textfield it shows very well.

  • Can add you value labels to the columns in a chart (without a custom design)?

    Is it possible to add the values for the columns in a chart to column itself without creating a custom for this column design? In this example, I represented the values in red I want will automatically appear in the data set.

    sample-column-labels.jpg

    FYI - in tutorial Lynda, Morty Golding shows a hack to do this, but it requires the creation of a custom column design. I wonder if there is a way to do it with just the default column design. Thank you!

    You need a custom column design to do this.

  • Dynamically add textfields on adf

    Hi I have the following code in javascript

    function Add() {}

    var clone is document.getElementById ("container_block") .cloneNode (true);.

    clone.setAttribute ('id', 'newid');

    var foo = document.getElementById ('container');

    foo.appendChild (clone);

    }

    function deleteNode (html_id) {}

    var x;

    x = document.getElementById (html_id);

    If (x.innerHTML) {x.innerHTML = ";}}

    x.parentNode.removeChild (x);

    }

    that works very well in HTML but I do not understand, or I don't know how it works on a page jspx is posible? or can someone give some advice on how to proceed

    Thanks before hand

    If I understand your use case it will be similar to a situation where you a service and you want to add to her employees.

    Thus, a relationship simple master detail on the page with a button that makes a createInsert on the details should work.

    I do not see that should be added dynamically with UI elements - just add records in the DB instead.

    If you want to dynamically display components on a page based on the number of records in a table, you can use this approach, for example:

    https://blogs.Oracle.com/Shay/entry/creating_dynamic_adf_input_forms

    Or you can use a bean managed to add components inside another component with the getChildrens and the add - no need of JavaScript method.

  • Add a red label on import?

    I want red images label imported as part of the import process.  It is easy enough for the time to label them in the most recent 'import' collection but nevertheless so they seem willing labeled would be useful in my work flow.  Any ideas?

    Create a preset metadata with 'red' in the field 'Label' (information) and apply this preset metadata during import.

    Gossweiler beat

    Switzerland

  • LR CC: How can you add labels 'ABC' to multiple slides and how to apply the different transition and pan / zoom to select slides?

    I want to add different labels to most of the slides.  The 'ABC' option adds the same label to all slides with includes date shot and camera settings that I don't want.   I also want to control the slides have pan / zoom.  Seems to be something pretty basic that I'm missing?

    1. by clicking on [ABC] creates the text box.  By clicking on the menu dropdown determines what appears in the box.

    (and you can create multiple text boxes with different information!)

    "Custom text" will appear the same on each slide. The other choice pull metadata each individual slide - "Filename", "Caption", etc.

    The dialog box "Edit...". "you can create a combination of metadata to display in a box.

    In the dialog box "Edit...". "Alternatively, you can create something like this, where the text {Custom} is the same before the {file name}... etc.

     

    2 pan/Zoom is a feature very poor slide show-it is fixed and will apply to all slides without any possibility of control. Better to leave off...

  • problem adding a RadioButtonGroup to a sprite

    I take a simple quiz.  I create dynamically Sprites and on these Sprites, I add dynamically created TextFields that take text from an XML file.

    The TextFields contain questions.  Now, I want to add a RadioButtonGroup to each Sprite, but whenever I try to addChild I get the message telling me I can't force the RadioButtonGroup to a display object. I know that you can dynamically add RadioButtonGroups, so I'm confused.

    my mistake: TypeError: Error #1034: Type coercion failed: cannot convert fl.controls::RadioButtonGroup@214384a9 to flash.display.DisplayObject.

    my code:

    import flash.events. *;
    Fl.transitions import. *;
    flash.filters import. *;
    Fl.controls import. *;

    var lastTarget: *;
    var questionTxt:TextField = new TextField();
    var xml;
    var xmlList:XMLList;
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load (new URLRequest ("test.xml"));
    xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);

    var square: Array = new Array();
    var txtArray:Array = new Array();
    var rbgArray:Array = new Array();
    var myFormat:TextFormat = new TextFormat();
    myFormat.font = "Verdana";
    myFormat.color = '0 x 000000';
    myFormat.size = "17";
    myFormat.leftMargin = "8";
    myFormat.rightMargin = "8";

    function xmlLoaded(e:Event):void {}
    XML = XML (e.Target.Data);
    xmlList = xml.children ();
    trace (xmlList.length ());

    for (var i: int = 0; i < xmlList.length (); i ++) {}
    var square: Sprite = new Sprite();
    var questionTxt:TextField = new TextField();
    square.graphics.beginFill (Math.random () * 0xffffff);
    txtArray.push (questionTxt);
    RadioButtonGroup created here *.
    var myRadioGroup:RadioButtonGroup = new RadioButtonGroup ("options");
    myRadioGroup.addEventListener (Event.CHANGE, changeHandler);
    var radio1:RadioButton = new RadioButton();
    Radio1.label = "Option has ';
    Radio1.value = 'option ".
    Radio1.Group = myRadioGroup;
    Radio1.move (10, 60);
    addChild (radio1);
    var radio2:RadioButton = new RadioButton();
    Radio2.label = "Option B";
    Radio2.value = "optionB."
    Radio2.Group = myRadioGroup;
    Radio2.move (10, 90);
    addChild (radio2);
    var radio3:RadioButton = new RadioButton();
    Radio3.label = "Option C";
    Radio3.value = "optionC."
    Radio3.Group = myRadioGroup;
    Radio3.move (10, 120);
    addChild (radio3);
    var radio4:RadioButton = new RadioButton();
    Radio2.label = ' Option D ';
    Radio2.value = 'option ".
    Radio2.Group = myRadioGroup;
    Radio2.move (10, 140);
    addChild (Zealand.4);
    var radio5:RadioButton = new RadioButton();
    Radio3.label = "Option E";
    Radio3.value = "optionE";
    Radio3.Group = myRadioGroup;
    Radio3.move (10, 170);
    addChild (radio5);

    rbgArray.push (myRadioGroup);   newly created groups, has added to the table
    //*******************************************************

    If (i %2 == 0) {}
    square.graphics.beginFill (0xee9873);
    } else {}
    square.graphics.beginFill (0x3789ee);
    }
    squares.push (Square);
    squares [i].graphics.drawRect (0, 0, 320, 240);
    squares [i] .x = i * 3;
    squares [i] there = i * 3;
    .filters square [i] = [];
    addChild (squares [i]);
    }
    setSquares();
    }

    function setSquares (): void {}

    for (var j: int = 0; j < squares.length; j ++) {}

    txtArray [j] .text = xmlList [j] .child ("questionText");

    txtArray [j] .width = 300;
    txtArray [j] = TextFieldType.DYNAMIC .Guy
    .multiline txtArray [j] = true;
    .wordWrap txtArray [j] = true;
    .selectable txtArray [j] = false;
    squares [j]. AddChild (txtArray [j]);
    txtArray [j] .setTextFormat (myFormat);
    squares [j] .addEventListener (MouseEvent.MOUSE_DOWN, dragMovie);
    squares [j] .addEventListener (MouseEvent.MOUSE_UP, dropMovie);
    square [j] .buttonMode = true;
    squares [j]. AddChild (rbgArray [j]);
    trace (rbgArray [j]. ToString());  the trace shows 15 [RadioButtonGroup object] as it should
    }
    }
    function dragMovie(event:MouseEvent):void {}
    event.target.startDrag ();
    If (event.target.filters =="") {}
    drpShdow = false;
    bevl = false;
    }
    }

    function dropMovie(event:MouseEvent):void {}
    lastTarget = event.currentTarget;
    event.target.stopDrag ();
    }

    function changeHandler(event:Event):void {}
    var rbg:RadioButtonGroup = event.target as RadioButtonGroup;
    If (rbg.selectedData! = null) {}
    trace (RBG.selectedData);
    } else {}
    trace ("no value specified.");
    }
    }

    This is because a RadioButtonGroup is not a subclass of DisplayObject.  You must add each RadioButton in the group individually.

  • Presentation of the card: 2nd card doesn't show text in the TextField

    I have a java swing application that implements the map layout and observer template. Basically, in the first map, I key in numbers in the button TextField and click on 'get number', it will run the Calculate class, which returns the number, which then informed his observer who is the Snd class. In the 2nd card (NDS class), it is supposed to set the number passed through the Observable (class Calculate) on the TextField. But my problem is that the textfield on the 2nd map does not appear any text. I already tried the getText method using the print method, and it returns the correct value for the observer last updated. It's just that TextField doesn't show anything. This is executable code.

    CardWindow.java

    import java.awt.CardLayout;
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    
    
    public class CardWindow {
      private JFrame f;
      private JPanel panel_2;
      private JPanel panel_1;
      private JButton btnNext, btnBack;
      Calculate watched;
      Snd watcher;
    
    
      /**
      * Launch the application.
      */
      public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
      public void run() {
      try {
      CardWindow window = new CardWindow();
      window.f.setVisible(true);
      } catch (Exception e) {
      e.printStackTrace();
      }
      }
      });
      }
    
    
      /**
      * Create the application.
      */
      public CardWindow() {
      initialize();
      }
    
    
      /**
      * Initialize the contents of the frame.
      */
      private void initialize() {
      f = new JFrame();
      f.setBounds(100, 100,500,300);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.getContentPane().setLayout(new CardLayout(0, 0));
      panel_1 = new Main_1();
      panel_2 = new Snd();
      f.getContentPane().add(panel_1);
      f.getContentPane().add(panel_2);
      panel_1.setVisible(true);
      panel_2.setVisible(false);
      btnNext = new JButton("Next");
      btnNext.setBounds(300, 100, 161, 29);
      panel_1.add(btnNext);
      btnNext.addActionListener(new ActionListener() {
    
      public void actionPerformed(ActionEvent e) {
      panel_1.setVisible(false);
      panel_2.setVisible(true);
      System.out.println("Next card");
      }
      });
      btnBack = new JButton("Back");
      btnBack.setBounds(300, 100, 75, 29);
      panel_2.add(btnBack);
      btnBack.addActionListener(new ActionListener() {
    
      public void actionPerformed(ActionEvent e) {
      panel_2.setVisible(false);
      panel_1.setVisible(true);
      System.out.println("Return previous");
      }
      });
      }
    }
    
    



    Main_1.Java

    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    
    
    public class Main_1 extends JPanel {
      private static final long serialVersionUID = 1L;
      private JTextField textField;
      private JButton btnCalculate;
      Calculate watched;
    
    
      public Main_1() {
      System.out.println("View1()");
    
    setLayout(new FlowLayout());
    
      textField = new JTextField();
      textField.setBounds(37, 80, 134, 28);
      add(textField);
      textField.setColumns(10);
      btnCalculate = new JButton("Get number");
      btnCalculate.setBounds(47, 131, 117, 29);
      add(btnCalculate);
      btnCalculate.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      watched = new Calculate();
      watched.calculate(textField.getText());
      }
      });
      }
    }
    
    

    Snd.Java

    import java.util.Observable;
    import java.util.Observer;
    
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    
    public class Snd extends JPanel implements Observer {
    
     private static final long serialVersionUID = 1L;
      JTextField textField2;
      private Calculate cal;
      private JLabel label;
    
      Snd() {
      System.out.println("View2()");
    
    setLayout(new FlowLayout());
    
    
      textField2 = new JTextField();
      textField2.setBounds(85, 121, 134, 28);
      add(textField2);
    
      label = new JLabel();
      label.setBounds(129, 200, 61, 16);
      add(label);
      System.out.println("Testing");
      }
    
      public void update(Observable obs, Object obj) {
      System.out.println ("View      : Observable is " + obs.getClass() + ", object passed is " + obj.getClass());
      cal = (Calculate) obs;
      System.out.println("Update: " + cal.getNum() + " " + obj);
      textField2.setText(Integer.toString(cal.getNum()));
      System.out.println(textField2.isDisplayable());
      System.out.println(textField2.getText());
      label.setText(Integer.toString(cal.getNum()));
      }
    }
    
    

    Calculate.Java

    import java.util.Observable;
    
    public class Calculate extends Observable {
     private int abc;
    
      public Calculate () {
      System.out.println("Model()");
      }
    
      public void setValue(int num) {
      System.out.println("Initial value: " + abc);
      this.abc = num;
      setChanged();
      System.out.println("Initial notify observer");
      notifyObservers(abc);
      }
    
      public void calculate(String number) {
      Snd watcher = new Snd();
      addObserver(watcher);
      System.out.println("hasChanged: " + hasChanged());
      abc = Integer.valueOf(number);
      System.out.println("Number: " + abc);
      setChanged();
      System.out.println("hasChanged: " + hasChanged());
      notifyObservers(abc);
      System.out.println("Notify observer");
      }
    
      public int getNum() {
      return abc;
      }
    }
    
    

    It works for me:

    public class CardLayoutTest {
    
         private static final String SECOND_PANEL = "secondPanel";
         private static final String FIRST_PANEL = "firstPanel";
         private static final CardLayout cardLayout = new CardLayout();
    
         public static void main(String[] args) {
              final JPanel mainPanel = new JPanel(cardLayout);
    
              JPanel firstPanel = new JPanel(new FlowLayout());
              JPanel secondPanel = new JPanel(new FlowLayout());
    
              mainPanel.add(firstPanel, FIRST_PANEL);
              mainPanel.add(secondPanel, SECOND_PANEL);
    
              final JTextField input = new JTextField(30);
              firstPanel.add(input);
              final JTextField output = new JTextField(30);
              secondPanel.add(output);
              Observer observer = new Observer() {
    
                   @Override
                   public void update(Observable o, Object arg) {
                        output.setText(String.format("got value from first panel %s", input.getText()));
                   }
              };
              final Observable observable = new Observable(){
    
                   @Override
                   public void notifyObservers() {
                        setChanged();
                        super.notifyObservers();
                   }
    
              };
              observable.addObserver(observer);
    
              firstPanel.add(new JButton(new AbstractAction("toSecondCard") {
    
                   @Override
                   public void actionPerformed(ActionEvent arg0) {
                        observable.notifyObservers();
                        cardLayout.show(mainPanel, SECOND_PANEL);
                   }
              }));
    
              secondPanel.add(new JButton(new AbstractAction("back") {
    
                   @Override
                   public void actionPerformed(ActionEvent arg0) {
                        input.setText("");
                        cardLayout.show(mainPanel, FIRST_PANEL);
                   }
              }));
              JOptionPane.showMessageDialog(null, mainPanel, "CardLayoutTest", JOptionPane.PLAIN_MESSAGE);
    
         }
    
    }
    

    Good bye

    TT

  • How to add dynamic names to MC in AS3?

    Hello

    I am trying to create a script simple enough image for a flash site. What it does is create a container named mc and then load a picture in the mc of XML. It traverses the XML file as in a loop for each. But the problem I have is that each container image then gets the name mc. So now when I try to compile the function that allows to press one of the containers image to enlarge, it is the last great picture because it's the last of them to be created with the name mc. So, how can I give each movieclip that I create a different name as mc1, mc2 etc.

    This is my XML:

    <? XML version = "1.0" encoding = "utf-8"? >

    < entries >

    < Entry >

    < phpText > title < / phpText >

    IMG/500.png < image > < / image >

    < phpWidth > 500 < / phpWidth >

    < phpHeight > 400 < / phpHeight >

    < / Entry >

    < Entry >

    < phpText > title 3 < / phpText >

    IMG/300.png < image > < / image >

    < phpWidth > 300 < / phpWidth >

    < phpHeight > 900 < / phpHeight >

    < / Entry >

    < Entry >

    < phpText > Title2 < / phpText >

    IMG/1440.png < image > < / image >

    < phpWidth > 1440 < / phpWidth >

    < phpHeight > 900 < / phpHeight >

    < / Entry >

    < Entry >

    < phpText > title < / phpText >

    IMG/500.png < image > < / image >

    < phpWidth > 500 < / phpWidth >

    < phpHeight > 400 < / phpHeight >

    < / Entry >

    < / input >

    AS3 code:

    import flash.events.Event;

    Import fl.text.TLFTextField;

    import flash.text.TextFieldAutoSize;

    import flash.text.TextFormat;

    import flash.display.Sprite;

    import flash.display.MovieClip;

    var iX:int = 15;

    var iY:int = 15;

    var tX:int = 15;

    var tY:int = 100;

    var id: int = 0;

    var urlRequest:URLRequest = new URLRequest ("data.xml");

    var urlLoader:URLLoader = new URLLoader();

    urlLoader.addEventListener (Event.COMPLETE, urlLoaded);

    urlLoader.load (urlRequest);

    function urlLoaded(e:Event) {}

    If {(urlLoader.data)

    var entriesData = new XML (urlLoader.data);

    var entries = entriesData.entry;

    for each {(var entrée: XML entrées)}

    Add variables

    Shall var = entry.image;

    var oText = entry.phpText;

    var oWidth = entry.phpWidth;

    var oHeight = entry.phpHeight;

    Create image GraphHolder

    var cont = ["mc" + id];

    var mc:MovieClip = new MovieClip();

    mc.graphics.beginFill (0xffffff);

    mc.graphics.drawRect (0, 0, oWidth, oHeight);

    mc.graphics.endFill ();

    MC.x = iX;

    MC.y = iY;

    this.addChild (mc);

    Add images to the GraphHolder

    var urlReq1:URLRequest = new URLRequest (shall);

    var urlLoad1:Loader = new Loader();

    urlLoad1.load (urlReq1);

    mc.addChild (urlLoad1);

    MC. Width = 100;

    MC. Height = 80;

    mc.addEventListener (MouseEvent.CLICK, onClickHandler);

    var origX = mc.x;

    var origY = mc.y;

    function onCloseHandler(myEvent:MouseEvent) {}

    MC. Width = 100;

    MC. Height = 80;

    MC.x = origX;

    MC.y = origY;

    myTextField.visible = true;

    mc.removeEventListener (MouseEvent.CLICK, onCloseHandler);

    }

    function onClickHandler(myEvent:MouseEvent) {}

    If {(oWidth > 1060)

    var allowedW = oWidth - 1060;

    oWidth = oWidth - allowedW;

    oHeight = oHeight - allowedW;

    }

    If {(oHeight > 700)

    var allowedH = oHeight - 700;

    oWidth = oWidth - allowedH;

    oHeight = oHeight - allowedH;

    }

    myTextField.visible = false;

    var picPosX = 1100 - oWidth;

    var picPosY = 730 - oHeight;

    MC.x = (picPosX / 2)-194;

    MC.y = (picPosY / 2)-148;

    MC. Width = oWidth;

    MC. Height = oHeight;

    mc.addEventListener (MouseEvent.CLICK, onCloseHandler);

    }

    Format textfield

    var myFormat:TextFormat = new TextFormat();

    myFormat.color = 0 x 000000;

    myFormat.font = "Arial";

    myFormat.size = 13;

    Create new textfield

    var myTextField:TextField = new TextField ();

    myTextField.width = 100;

    myTextField.x = tX;

    myTextField.y = tY;

    myTextField.selectable = true;

    myTextField.type = TextFieldType.DYNAMIC;

    myTextField.multiline = false;

    myTextField.border = false;

    myTextField.wordWrap = false;

    myTextField.autoSize = TextFieldAutoSize.CENTER;

    myTextField.defaultTextFormat = myFormat;

    Add text to a textfield

    myTextField.text = oText;

    Add textfield

    addChild (myTextField);

    iX = iX + (mc.width + 15);

    tX = tX + (mc.width + 15);

    If {(iX > 650)

    iX = 15;

    iY = iY + 115;

    tX = 15;

    tY = tY + 115;

    }

    }

    }

    }

    Very grateful for the help!

    Best,

    Linus

    In the features that your buttons/mcs call when they get clicked is where you can use the event.currentTarget to target the.  Points to the object that was clicked event.currentTarget which has the event listener are entrusted to him.

  • Adding a mask for a sprite

    I can't add a mask to a sprite, here, is the reason why:

    After what you add in the current display list (I hope it is), the area of masking of the sprite is bkack and covers it instead of display content, and anywhere else the mask is not located, sprite shows. It seems to show the opposite of what it should. If I do not use the mask, sprites do not show neither exist at all, and with it they appear, similar with the help of just a movieclip filled in the 'other' sprite.

    Here are the conditions:

    I made a sprite with a given size and location (let's call it the main sprite). Then I added two sprites to this main sprite, and one of the two was the mask to the other. Then for the 'other' sprite in hand, I made a loop for and filled some with textfields by using a database. Then, filled the sprite mask of color. Also, the main sprite was identical to the sprite mask size so that they are identical.

    var mainSprite:Sprite = new Sprite();
    var maskSprite = new Sprite();
    var otherSprite = new Sprite();
    mainSprite.addChild (maskSprite ());
    mainSprite.addChild (otherSprite ());
    otherSprite.mask = maskSprite;
    for {(details here)
    TextFields randomly entered into this field in the other sprite in the conditions, etc.
    }
    maskSprite.graphics.beginFill (0xFF0000);
    maskSprite.graphics.drawRect (0, 241, 530, 141);
    addChild (mainSprite);

    Note: I'm using AS3

    Nevermind, I use movieclip with a sprite object as is the mask. Works very well.

  • Add ButtonField on BitmapFiled

    Hi all

    I tried to use this code to add BitmapButtonField on BitmapField but I couldn't use it.

    Ant one can help me?

    package mypackage;
    
    import com.operations.images.ImageManipulator;
    
    import net.rim.device.api.system.Application;
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.system.JPEGEncodedImage;
    import net.rim.device.api.ui.TouchEvent;
    import net.rim.device.api.ui.TouchGesture;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.SeparatorField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    /**
     * A class extending the MainScreen class, which provides default standard
     * behavior for BlackBerry GUI applications.
     */
    public final class MyScreen extends MainScreen {
    
        private static int rotatedAngle = 360;
    
        // byte[] rrr = resizeImage(Bitmap.getBitmapResource("gear.png"),
        // Display.getWidth(), Display.getHeight() / 2);
        // Bitmap originalBmp = Bitmap.createBitmapFromBytes(rrr, 0, rrr.length, 1);
        Bitmap originalBmp = Bitmap.getBitmapResource("[email protected]");
        BitmapField rotatedBitmap = new BitmapField(originalBmp);
    
        private BitmapButtonField buttonField1 = new BitmapButtonField(
                Bitmap.getBitmapResource("images_1.png"));
        private BitmapButtonField buttonField2 = new BitmapButtonField(
                Bitmap.getBitmapResource("images_2.png"));
    
        VerticalFieldManager bmpManager = new VerticalFieldManager(USE_ALL_WIDTH
                | NO_HORIZONTAL_SCROLL | NO_VERTICAL_SCROLL) {
    
            public int getPreferredHeight() {
                return rotatedBitmap.getHeight();
            };
    
            public int getPreferredWidth() {
                return rotatedBitmap.getWidth();
            };
    
            protected void sublayout(int maxWidth, int maxHeight) {
    
                layoutChild(rotatedBitmap, originalBmp.getWidth(),
                        originalBmp.getHeight());
                layoutChild(buttonField1, buttonField1.getPreferredWidth(),
                        buttonField1.getPreferredHeight());
                layoutChild(buttonField2, buttonField2.getPreferredWidth(),
                        buttonField2.getPreferredHeight());
    
                setPositionChild(rotatedBitmap, 0, 0);
                setPositionChild(buttonField1, 0, 50);
                setPositionChild(buttonField2, 50, 50);
    
                super.sublayout(getPreferredWidth(), getPreferredHeight());
                setExtent(getPreferredWidth(), getPreferredHeight());
    
            };
        };
    
        VerticalFieldManager manager = new VerticalFieldManager(USE_ALL_WIDTH
                | NO_HORIZONTAL_SCROLL | NO_VERTICAL_SCROLL) {
    
            public int getPreferredHeight() {
                return Display.getHeight() - bmpManager.getPreferredHeight();
            };
    
            public int getPreferredWidth() {
                return Display.getWidth();
            };
        };
    
        /**
         * Creates a new MyScreen object
         */
        public MyScreen() {
            super(USE_ALL_WIDTH | USE_ALL_HEIGHT);
            // Set the displayed title of the screen
            setTitle("Test Animation");
    
            bmpManager.add(rotatedBitmap);
            bmpManager.add(buttonField1);
            bmpManager.add(buttonField2);
    
            manager.add(new SeparatorField());
            manager.add(new SeparatorField());
            manager.add(new LabelField(" label 1 "));
            manager.add(new LabelField(" label 2 "));
            manager.add(new LabelField(" label 3 "));
    
            add(bmpManager);
    
            add(manager);
    
        }
    
        protected boolean touchEvent(TouchEvent message) {
            switch (message.getEvent()) {
            case TouchEvent.CLICK:
                // invokeDialog("-->CLICK");
                return true;
            case TouchEvent.DOWN:
                // invokeDialog("-->DOWN");
                return true;
    
            case TouchEvent.GESTURE:
                TouchGesture gesture = message.getGesture();
                int gestureCode = gesture.getEvent();
    
                if (gesture.getSwipeDirection() == TouchGesture.SWIPE_NORTH) {
                    invokeDialog("swip north : " + gesture.getSwipeAngle() + " , "
                            + gesture.getSwipeMagnitude());
                } else if (gesture.getSwipeDirection() == TouchGesture.SWIPE_SOUTH) {
                    invokeDialog("swip south : " + gesture.getSwipeAngle() + " , "
                            + gesture.getSwipeMagnitude());
                } else if (gesture.getSwipeDirection() == TouchGesture.SWIPE_EAST) {
                    if ((message.getX(1) >= bmpManager.getContentRect().x && message
                            .getX(1) <= bmpManager.getContentRect().width)
                            && (message.getY(1) >= bmpManager.getContentRect().y && message
                                    .getY(1) <= bmpManager.getContentRect().height)) {
    
                        // invokeDialog("swip east : " + gesture.getSwipeAngle()
                        // + " , " + gesture.getSwipeMagnitude());
                        rotate(true);
    
                    }
                } else if (gesture.getSwipeDirection() == TouchGesture.SWIPE_WEST) {
                    if ((message.getX(1) >= bmpManager.getContentRect().x && message
                            .getX(1) <= bmpManager.getContentRect().width)
                            && (message.getY(1) >= bmpManager.getContentRect().y && message
                                    .getY(1) <= bmpManager.getContentRect().height)) {
    
                        // invokeDialog("x = " + bmpManager.getContentRect().x +
                        // " , "
                        // + bmpManager.getContentRect().width + " \ny = "
                        // + bmpManager.getContentRect().y + " , "
                        // + bmpManager.getContentRect().height + "\n mx = "
                        // + message.getX(1) + " , " + message.getY(1));
                        // invokeDialog("swip west : " + gesture.getSwipeAngle()
                        // + " , " + gesture.getSwipeMagnitude());
                        rotate(false);
    
                    }
                }
    
                return true;
    
            case TouchEvent.MOVE:
                // int moveSize = message.getMovePointsSize();
                // int[] x_points;
                // int[] y_points;
                // int[] time_points;
                // int size = message.getMovePointsSize();
                // x_points = new int[size];
                // y_points = new int[size];
                // time_points = new int[size];
                // message.getMovePoints(1, x_points, y_points, time_points);
                //
                // if (x_points.length >= 50) {
                // invokeDialog("-->move : " + size);
                // }else if(x_points.length == 2){
                // invokeDialog("-->move : ssss = " + 2);
                // }
                return true;
            }
            System.out.println("PRINT ME SOMETHING IN ANY CASE");
            return false;
        }
    
        private void rotate(final boolean east) {
    
            synchronized (Application.getEventLock()) {
                UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                    public void run() {
                        // wipe east
                        if (east) {
                            // if (rotatedAngle >= 0) {
                            for (int i = 0; i < 45; i += 1) {
                                try {
                                    rotatedAngle -= i;
                                    rotatedBitmap.setBitmap(ImageManipulator
                                            .rotate(originalBmp, rotatedAngle));
                                    bmpManager.invalidate();
                                    // bmpManager.deleteAll();
                                    // bmpManager.add(new
                                    // BitmapField(rotatedBitmap));
    
                                    // Thread.sleep(100);
                                } catch (Exception e) {
                                }
                            }
                            // }
                        } else {
                            // swipe weast
                            // if (rotatedAngle <= 360) {
                            for (int i = 0; i < 45; i += 1) {
                                try {
                                    rotatedAngle += i;
                                    rotatedBitmap.setBitmap(ImageManipulator
                                            .rotate(originalBmp, rotatedAngle));
                                    bmpManager.invalidate();
                                    // bmpManager.deleteAll();
                                    // bmpManager.add(new
                                    // BitmapField(rotatedBitmap));
    
                                    // Thread.sleep(100);
                                } catch (Exception e) {
                                }
                            }
                            // }
    
                        }
                    }
                });
    
            }
        }
    
        public static void invokeDialog(final String msg) {
            UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                public void run() {
                    Dialog.inform(msg);
                }
            });
        }
    
        public static byte[] resizeImage(Bitmap srcBitmap, int width, int height) {
            // int width = 0;
            // int height = 0;
            // Bitmap srcBitmap = Bitmap.createBitmapFromBytes(image, 0,
            // image.length,
            // 1);
            // if (srcBitmap.getWidth() > srcBitmap.getHeight()) {
            // width = widthT;
            // height = (widthT * srcBitmap.getHeight()) / srcBitmap.getWidth();
            // } else if (srcBitmap.getWidth() < srcBitmap.getHeight()) {
            // height = heightT;
            // width = (height * srcBitmap.getWidth()) / srcBitmap.getHeight();
            // } else {
            // width = widthT;
            // height = heightT;
            // }
            Bitmap destBitmap = new Bitmap(width, height);
            srcBitmap.scaleInto(destBitmap, Bitmap.FILTER_BILINEAR);
            JPEGEncodedImage encoded = JPEGEncodedImage.encode(destBitmap, 100);
            return encoded.getData();
        }
    }
    

    Thank you

    I tried to improve my code and I found the solution

    /**
     * @author : Ahmed Shoeib
     * @description : add BitmapButtonField over BitmapField
     */
    public final class MyScreen extends MainScreen {
    
        Bitmap originalBmp = Bitmap.getBitmapResource("[email protected]");
        BitmapField rotatedBitmap = new BitmapField(originalBmp);
    
        BitmapButtonField buttonField1 = new BitmapButtonField(
                Bitmap.getBitmapResource("images_1.png"));
        BitmapButtonField buttonField2 = new BitmapButtonField(
                Bitmap.getBitmapResource("images_2.png"));
    
        Manager mainManager = new Manager(USE_ALL_WIDTH | NO_HORIZONTAL_SCROLL
                | NO_VERTICAL_SCROLL) {
    
            public int getPreferredHeight() {
                return rotatedBitmap.getHeight();
            };
    
            public int getPreferredWidth() {
                return rotatedBitmap.getWidth();
            };
    
            protected void sublayout(int width, int height) {
    
                setPositionChild(rotatedBitmap, 0, 0);
                layoutChild(rotatedBitmap, rotatedBitmap.getPreferredWidth(),
                        rotatedBitmap.getPreferredHeight());
    
                setPositionChild(buttonField1, getPreferredWidth() / 2, 0);
                layoutChild(buttonField1, buttonField1.getPreferredWidth(),
                        buttonField1.getPreferredHeight());
    
                setPositionChild(buttonField2, getPreferredWidth() / 2,
                        getPreferredHeight() / 2);
                layoutChild(buttonField2, buttonField2.getPreferredWidth(),
                        buttonField2.getPreferredHeight());
    
                setExtent(getPreferredWidth(), getPreferredHeight());
            }
        };
    
        VerticalFieldManager bottomManager = new VerticalFieldManager(USE_ALL_WIDTH
                | NO_HORIZONTAL_SCROLL | NO_VERTICAL_SCROLL) {
    
            public int getPreferredHeight() {
                return Display.getHeight() - mainManager.getPreferredHeight();
            };
    
            public int getPreferredWidth() {
                return Display.getWidth();
            };
        };
    
        /**
         * Creates a new MyScreen object
         */
        public MyScreen() {
            super(USE_ALL_WIDTH | USE_ALL_HEIGHT);
            // Set the displayed title of the screen
            setTitle("Test Animation");
    
            mainManager.add(rotatedBitmap);
            mainManager.add(buttonField1);
            mainManager.add(buttonField2);
    
            bottomManager.add(new LabelField("fffffffffff"));
            bottomManager.add(new LabelField("fffffffffff"));
            bottomManager.add(new LabelField("fffffffffff"));
    
            add(mainManager);
            add(bottomManager);
    
        }
    
    }
    

    Thank you

Maybe you are looking for