Share Posted January 25, 2010 Hello Im evaluating your commponets, it´s possible to do This. Create and put objects in a restricted area (square) taking data from a XML. Upoload images in to the square from links. obtain the data (parameters) of the objects when the user close the app and write into the XML file Parameters position x y and z size width heigth content image & text control bounds of objects Link to comment Share on other sites More sharing options...
Share Posted January 25, 2010 I assume you're talking about TransformManager, right? Yes, you can do stuff in a completely dynamic way. However, TransformManager doesn't natively do ALL of what you said, like loading XML. You need to do that part yourself, but you can certainly set bounds and position dynamically-loaded objects, etc. In fact, I'd venture to say that most TransformManager users do that. It's completely ActionScript-driven, so you don't need to set a bunch of things up in the IDE ahead of time. Keep in mind that there's a 30-day money back guarantee too, so if it doesn't accommodate your requirements, you can get a full refund. Link to comment Share on other sites More sharing options...
Author Share Posted January 26, 2010 Hello again I buy your solution,In your example function very well, I copy your examples in a new .fla and not works, for example if you use this import com.greensock.transform.*; import com.greensock.events.TransformEvent; import flash.geom.*; import flash.events.*; import flash.display.MovieClip; import fl.controls.*; var manager:TransformManager = new TransformManager({targetObjects:[myClip1, myClip2]}); return the output window this 1172: Definition com.greensock.transform could not be found. and other3 lines of error In which part assign your component or activate your code, which step i miss Link to comment Share on other sites More sharing options...
Share Posted January 26, 2010 It sounds like you didn't copy the "com" folder with all the ActionScript code in it - that must be in the same directory as your FLA file, otherwise Flash cannot find the class files. Link to comment Share on other sites More sharing options...
Author Share Posted January 26, 2010 Thanks, & sorry , one question more, it´s posible in the text field to restrict the field text when the box is full,? Link to comment Share on other sites More sharing options...
Share Posted January 26, 2010 No, that's not a feature of TransformManager, but you can set the minScaleX and minScaleY to restrain the size if you want. Link to comment Share on other sites More sharing options...
Author Share Posted January 26, 2010 Hi again. Another two question, how can I detect which is the instance of the movie the user selected and you have somo example to use the "matrix" to store the data, thanks Link to comment Share on other sites More sharing options...
Share Posted January 27, 2010 how can I detect which is the instance of the movie the user selected? myManager.addEventListener(TransformEvent.SELECT, mySelectionHander); function mySelectionHandler(event:TransformEvent):void { for (var i:int = 0; i trace("selected "+event.items[i]); } } Or to find out what's selected anytime, just use myManager.selectedItems or myManager.selectedTargetObjects. do you have some example to use the "matrix" to store the data, thanks var matrix:Matrix = myObject.transform.matrix; //store these values: var a:Number = matrix.a; var b:Number = matrix.b; var c:Number = matrix.c; var d:Number = matrix.d; var tx:Number = matrix.tx; var ty:Number = matrix.ty; (I'm not sure exactly how you plan to store them, but that's the data - 6 values). Hope that helps. Link to comment Share on other sites More sharing options...
Author Share Posted January 29, 2010 Basicly, I need to re create the position, Scale an size of the objects every time it user acces to his page, and need to save the data of his objects, to this the solution is use the matrix? or simply can acces to the name of the object and aply this parameters directly(the x y height and width only) Link to comment Share on other sites More sharing options...
Share Posted January 29, 2010 The problem with saving the x, y, width, height, and rotation of the objects is that it won't accommodate any skewing that can occur with multiple selections. For example, imagine selecting one object, rotating it 45 degrees, then ADDING another object to the selection and scaling both down vertically - the first one will get skewed. The only way to accurately replicate this is by using the transform.matrix properties. It's really easy, though. Do what I showed you above, and then to reapply the values, do this: myObject.transform.matrix = new Matrix(a, b, c, d, tx, ty); Link to comment Share on other sites More sharing options...
Author Share Posted January 31, 2010 Hello Again, First thanks for all your help, and congratulations for your solution. I find the solution to my question thanks again Link to comment Share on other sites More sharing options...
Author Share Posted February 1, 2010 Hi Again, one more question, exist one function to know if any or some manager object(s) are selected Link to comment Share on other sites More sharing options...
Share Posted February 1, 2010 Hi Again, one more question, exist one function to know if any or some manager object(s) are selected Sure, just check the selectedItems property to see if the Array is empty. if (myManager.selectedItems.length > 0) { trace("something is selected"); } Link to comment Share on other sites More sharing options...
Author Share Posted February 9, 2010 Sorry false alarm Link to comment Share on other sites More sharing options...
Author Share Posted February 17, 2010 Hello Again I have another question, I detect the object Using next: function selItem(e:MouseEvent) { if (manager.selectedItems.length > 0) { MovieClip(root).campo.text="seleccionado Se mueve "+namSelect+" ob "+nombre+" length "+textos.length+"manager.selectedItems"+manager.selectedItems.length; } namSelect=e.currentTarget.name; // for (var k:Number = 0; k < textos.length; k++) { if (textos[k].name==namSelect) { nombre=k; break; } } } but when you put the cursor in the border of the object and the drag icon appears you can move the object but you can get the name of the object, only get the name of the object when you are clicking in the middle I think this is a part invisible above of the object, I try to use your recomendation var manager:TransformManager; manager = new TransformManager({targetObjects:[],lockRotation:true,bounds:new Rectangle(36, 117, 366, 319),scaleFromCenter:false,constrainScale:false,allowMultiSelect:false, forceSelectionToFront:true,allowDelete:false}); manager.handleSize = 5; manager.addEventListener(TransformEvent.SELECT, mySelectionHander); function mySelectionHandler(event:TransformEvent):void { for (var i:int = 0; i < event.items.length; i++) { trace("selected "+event.items); } } but dont work, In this project I´m adding Objects Dynamicly Other question, In the case of test boxes, by the adobe documentation, is not possible yet add a alpha to the backgroundcolor to the inputText field, is posible to do in you app. Thanks again and have a good day Link to comment Share on other sites More sharing options...
Share Posted February 17, 2010 TransformManager doesn't dispatch SELECT events, only SELECTION_CHANGE events (TransformItems dispatch SELECT events). So your code would look like: manager.addEventListener(TransformEvent.SELECTION_CHANGE, mySelectionHander); As for the background color of TextFields, TransformManager doesn't have anything to do with that but I suppose you could fake it by having a TextField with no background in front of a Shape that has alpha applied. Link to comment Share on other sites More sharing options...
Author Share Posted February 17, 2010 Excelent, one more thing, Itry servereal Things, but still trace me selected [object TransformItem] is posible Know this instances, Link to comment Share on other sites More sharing options...
Share Posted February 17, 2010 Sure, each TransformItem has a targetObject property. So you'd do: function mySelectionHandler(event:TransformEvent):void { for (var i:int = 0; i trace("selected "+event.items[i].targetObject); } } You can also get the manager's "selectedTargetObjects" property if you prefer to get all the selected targetObjects. Link to comment Share on other sites More sharing options...
Author Share Posted February 17, 2010 with this solution have some success, now can be Know the kind of the object selected [object MovieClip], but i need to Know the instanceName of the object. we add the object using manager.addItem() example var manager:TransformManager; manager = new TransformManager({targetObjects:[],lockRotation:true,bounds:new Rectangle(36, 117, 366, 319),scaleFromCenter:false,constrainScale:false,allowMultiSelect:false, forceSelectionToFront:true,allowDelete:false}); manager.handleSize = 5; var myTextField2:TextField = new TextField(); function crear(textDeafult):void { var textInside:String=textDeafult; myTextField2 = new TextField(); myTextField2.type = TextFieldType.INPUT; myTextField2.autoSize = TextFieldAutoSize.NONE; myTextField2.background = true; myTextField2.backgroundColor= 0xFFFF0000; myTextField2.borderColor= 0x4B0101; myTextField2.embedFonts = true; myTextField2.name ="textoOB"+iniTextNum; myTextField2.defaultTextFormat= format1; myTextField2.text = textInside; myTextField2.addEventListener(Event.CHANGE, changeText); myTextField2.addEventListener(MouseEvent.CLICK, selItem); myTextField2.alpha=.8; textos.push(myTextField2); addChild(myTextField2); manager.addItem(myTextField2); If select some object, I need to get the instance or the name, example "textoOB0, textoOB1" or the number of object to use in to Array may be your targetObjects:[] Link to comment Share on other sites More sharing options...
Share Posted February 17, 2010 Then just get the "name" property function mySelectionHandler(event:TransformEvent):void { for (var i:int = 0; i trace("selected "+event.items[i].targetObject.name); } } Link to comment Share on other sites More sharing options...
Author Share Posted March 1, 2010 Hello Jack. Is possible to restrict the rezisable area in a text field, the minimum must be the the width and height of the text field when the text are full filled the text field , In the forum and the documentation you mentioned. i try to do something but not works. manager.addEventListener(TransformEvent.SCALE, onScale); function onScale(e:TransformEvent):void { var namScale=e.items[0].targetObject; namScale.minScaleX=30; namScale.minScaleY=30; } Link to comment Share on other sites More sharing options...
Share Posted March 1, 2010 You set the minScaleX and minScaleY on the TransformItem instance, not the targetObject. Like: var item:TransformItem = myManager.addItem(myObject); item.minScaleX = .3; item.minScaleY = .3; Link to comment Share on other sites More sharing options...
Author Share Posted March 3, 2010 Thanks Jack, One question when I encrease the text in a text field the drag square dont actualize, Is possible to do this call one of you functions? I sen an example. Link to comment Share on other sites More sharing options...
Share Posted March 3, 2010 Whenever you manually change a targetObject, you should call update() on the associated TransformItem. Link to comment Share on other sites More sharing options...
Author Share Posted March 10, 2010 Hello Jack, again me, Sorry, on more question it is possible to add a scroll bar only when the text are out bounds of the text field or Know if this are happening? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now