Jump to content
Search Community

Dynamic application

Emilio test
Moderator Tag

Recommended Posts

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

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

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

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

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

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

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

  • 2 weeks later...

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

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

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

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

  • 2 weeks later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...