Jump to content
Search Community

BernalCarlos

Members
  • Posts

    32
  • Joined

  • Last visited

Posts posted by BernalCarlos

  1. Hello,

     

    i have already asked this question in the following thread: http://forums.greensock.com/topic/6964-constrain-scaling-to-avoid-mirror-efects/

     

    The solution was to set the minScaleX and minScaleY to 0 and that worked, but now I need to constrain the width and height of a transformItem, not the scale. 

     

    So, i used the minWidth and minHeight properties of the item. At the beginning its seemed to work, however if I keep scaling beyond the min values, the item will eventually jump to negative scale values.

     

    I think its a bug but i don't know, any help will be greatly appreciated.

     

    Here a .fla that shows the problem:

    https://www.dropbox.com/s/wx6vtjho4vn0t9k/TransManager_MinWidthBug.fla

     

    Thank you.

  2. Hi,

     

    I have a Sprite with a button in the center. The sprite can be transformed, but when the mouse is over the button the cursor stays in its default TransformManager move cursor.

     

    So, to keep the default "button" cursor  (the one with the hand and the finger) when the mouse is over the button., i did the following:

     

    
    _uploadPhotoHereMessageMc.addPhoto_btn.addEventListener(MouseEvent.MOUSE_OVER, showButtonCursor, false, 0, true);
    
    private function showButtonCursor(evt: Event): void
    {
      if(_transManager.isShowingCustomCursor) TransformManager.customizeMoveCursor(new Shape(), false, 0, 0);
    }
    

     

    However, i'm getting a null pointer exception from the TransforManager:

     

    StackTrace: TypeError: Error #1009: No se puede acceder a una propiedad o a un método de una referencia a un objeto nulo.
    	at com.greensock.transform::TransformManager/snapCursor()[D:\datos\CarlosB\Documentos\Dropbox\PlasticoLab\Pixote2\PhotobookMaker\com\greensock\transform\TransformManager.as:2275]
    

     

    "No se puede acceder a una propiedad o a un método de una referencia a un objeto nulo"  -> means null pointer in Spanish.

     

    Is there a better way to do this?

     

  3. Hi, Here's what i did in code:

     

    //First, create the backgorund sprite for the color picker
    _colorPickerBackground = new Sprite();
    var g:Graphics = _colorPickerBackground.graphics;
    g.beginFill(0x000000, 0.3);
    g.drawRect(0, 0, 217, 177); //I found the dimensions by trial and error
    g.endFill();
    
    //Second, add the event listener to the color picker
    //My color picker is inside the _textEditor movieclip, but this is not necessary.
    _textEditor.colorPicker_cp.addEventListener(Event.OPEN, onColorPickerEnter, false, 0, true); 
    _textEditor.colorPicker_cp.addEventListener(Event.CLOSE, onColorPickerClose, false, 0, true);
    
    //Third, create the listener functions
    private function onColorPickerEnter(evt: Event): void{
    
      //Set the background x and y position
      _colorPickerBackground.x = _textEditor.x + _textEditor.colorPicker_cp.x + _textEditor.colorPicker_cp.width;
      _colorPickerBackground.y = _textEditor.y + _textEditor.colorPicker_cp.y;
    
      //Add the background to the ignore list
      _transManager.addIgnoredObject(_colorPickerBackground);
    
      //Finally, add the background behind the color picker. In my case, behind the _textEditor
      _mainStage.addChildAt(_colorPickerBackground, _mainStage.getChildIndex(_textEditor));
    
    }
    
    private function onColorPickerClose(evt: Event): void{
    
      //Remove the backgorund
      _mainStage.removeChild(_colorPickerBackground);
      _transManager.removeIgnoredObject(_colorPickerBackground);
      _colorPickerBackground = null
    }
    

     

    Hope it helps you.

  4. Found a not so tricky Solution! :lol:

     

    For some reason if you set a sprite behind the color picker, and add that background to the ignore objects, everything will work fine.

     

    So all you have to do is to listen for OPEN and CLOSE events on the Colorpicker, and when the Colorpicker is opened just dynamically create a background sprite for it, add it to the stage, add it to the ignore Objects, and finally on close just remove the background.

     

    Hope it help somebody.

     

    Thanks Jack.

    • Like 1
  5. Hello,

     

    Once again here i am asking for help.

     

    I'm trying to add the Colorpicker component to the list of ignored objects in the TransfromManager.

     

    I read some post on the forum, and Jack suggest to set the autoDeselect property to false, and add a background sprite that handles the deselect click.

     

    However, in the current state of my project doing that would involve a LOT of changes and i'm actually tacking advantage of the autoDeselect property.

     

    Is there another way i can add the color picker to the ignore objects?

     

    Thank you very much.

  6. When i encountered that problem i was working with pure AS3 not Flex, but looking at you your code i think i know whats your problem.

     

    This is the code i use to created the textfield:

     

    var font: Font = new FuturaStdBold();
    
    _textFormat = new TextFormat();
    _textFormat.size = DEFAULT_TEXT_SIZE;
    _textFormat.align = DEFAULT_TEXT_ALIGN;
    _textFormat.font = font.fontName;
    
    _textField = new TextField();
    _textField.width = DEFAULT_TEXT_WIDTH;
    _textField.height = DEFAULT_TEXT_HEIGHT;
    _textField.x = (_container.width - _textField.width) / 2;
    _textField.y = (_container.height - _textField.height) / 2;
    _textField.type = "input";
    _textField.multiline = true;
    _textField.embedFonts = true;
    

     

    Pay special attention to the part:

     

    _textField.embedFonts = true;
    

     

    the 'embedFonts' property had to be true.

     

    Hope it helps you.

  7. Hello,

     

    I'm trying to transform a text input field that should resize the text font size when scaling the transform item, and that should resize itself when the user writes text in it.

     

    To resize the text field i set the "autoSize" property to true, and to increase the font size i wrapped the text field with a movieclip and then add that to the TransformManager.

     

    Here is my code:

     

    //create the font format
    var font: Font = new FuturaStdBold();
    
    _textFormat = new TextFormat();
    _textFormat.size = 18;
    _textFormat.align = "center";
    _textFormat.font = font.fontName;
    
    //Create the text field
    _textField = new TextField();
    _textField.width = 200;
    _textField.height = 40;
    _textField.x = 100;
    _textField.y = 100;
    _textField.type = "input";
    _textField.multiline = true;
    _textField.embedFonts = true;
    
    _textField.autoSize = TextFieldAutoSize.CENTER;
    
    _textField.defaultTextFormat = _textFormat;
    _textField.text = "Ingresa tu texto aquí...";
    _textField.addEventListener(Event.CHANGE, keyStroked, false, 0, true);[/font]
    
    [font=arial, helvetica, sans-serif]//[/font][font=arial, helvetica, sans-serif]_mcConte is the wrapper for the text field[/font]
    [font=arial, helvetica, sans-serif]_mcConte.addChild(_textField);
    
    //add the item to the stage
    _container.addChild(_mcConte);
    
    //add the item to the transformManager
    _transItem = _transManager.addItem(_mcConte);
    _transItem.hasSelectableText = true;[/font]
    
    

     

    The resize of the text field works fine, however the scaling does not.

     

    When i try to scale the item and it has some rotation, the text field gets out of the transformManager Box, but if i set "hasSelectableText" to false, then the scaling works but i cant input text.

     

    Any help would be greatly appreciated.

     

    I attached some screenshots of the problem.

    post-12565-0-65948500-1357854870_thumb.png

    post-12565-0-83974900-1357854871_thumb.png

  8. Hi,

     

    I'm having a problem transforming a text field.

     

    When i move or scale the text field everything is fine, but when i rotate it, the text disappears.

     

    This is how i'm creating and adding the text field:

     

    //Create the text format
    var textFormat: TextFormat = new TextFormat();
    textFormat.size = DEFAULT_TEXT_SIZE;
    textFormat.align = DEFAULT_TEXT_ALIGN;
    textFormat.font = DEFAULT_TEXT_FONT;
    
    //Create the text field
    var textField: TextField = new TextField();
    textField.width = DEFAULT_TEXT_WIDTH;
    textField.height = DEFAULT_TEXT_HEIGHT;
    textField.x = (mc_stage.width - textField.width) / 2;
    textField.y = (mc_stage.height - textField.height) / 2;
    textField.type = "input";
    textField.multiline = true;
    textField.wordWrap = true;
    textField.defaultTextFormat = textFormat;
    textField.text = "Ingresa tu texto aquí...";
    
    
    //Add the field to the parent moveiclip
    mc_stage.addChild(textField);
    
    //Add the field to the transform manager
    var transItem: TransformItem = _transManager.addItem(textField);
    transItem.constrainScale = false;
    _transManager.selectItem(textField);
    

     

    Any idea of what may be happening?

     

    Tank you.

  9. Hello,

     

    I'm doing some really cool things with the TransformManager, but once again I need some help.

     

    Is there a way to constrain scaling to positive values, so that mirror effects do not happen?

     

    To make myself clear, take a look a the images:

     

    1. Original State - Ok Scaling: http://www.flickr.com/photos/90499524@N07/8273520758/in/photostream

     

    2. Still Ok Scaling: http://www.flickr.com/photos/90499524@N07/8272455391/in/photostream

     

    3. Not Ok Scaling:

    http://www.flickr.com/photos/90499524@N07/8273520798/in/photostream

     

    Thank you so much for your help.

  10. Hello,

     

    I'm using the applySettingXml method to configure the TransformManager from an external file.

     

    Everything work fine, but I don't know in which format the colors for the handle and the line are described.

     

    For example, to which color will translate a value of "16777215" for the handleColor?

     

    Thank you.

×
×
  • Create New...