Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

dave

Members
  • Posts

    12
  • Joined

  • Last visited

dave's Achievements

0

Reputation

  1. Try this. This is really old code and I don't know if it's depending on other things but should give you the general idea. Basically, you want to create an array which you can sort but to do so, you have to have a value that you can sort "by". So I have an array of objects; each object contains a reference to an item in my transform manager and also it's depth. This way, I can just sort on the depths... var tmObjectsUnsorted : Array = transformManager.targetObjects; var tmObjectsUnsorted_objects : Array = new Array(); for (var j : Number = 0; j < tmObjectsUnsorted.length; j++) { var thisObject : Object = new Object(); thisObject['itemDepth'] = itemsContainer.getChildIndex(tmObjectsUnsorted[j]); thisObject['item'] = tmObjectsUnsorted[j]; tmObjectsUnsorted_objects.push(thisObject); } var tmObjectsSorted : Array = tmObjectsUnsorted_objects.sortOn('itemDepth');
  2. Could be a few things... -- First of all, is your image definately loading in properly? Did you try just adding it to the stage to make sure it's not something in your loadMovie code? -- Also, which domain are you loading your image in from. Due to security restrictions, files loaded from a server other than the one your Flash movie is on can't be mucked around with too much. You can load them (if you have permission), but you can't modify them or do anything remotely advanced with them. For example, BitmapData's draw method is a no-no. If this is the case, I'm pretty sure the cross-domain thing is what's messing things up for you. -- Like Jack said, adding a delay will at least help you to see if that's causing the problem. I know you said it didn't help but did you try putting a really massive delay (a few seconds) on it just to make sure? Hope you have some luck with this but like I said, the cross-domain thing often slips people's minds and it can be infuriating not knowing why something's not working if you're not aware of this restriction so I thought it'd be worth pointing it out for you
  3. Ah, this new feature is great but there's a bug I've just noticed... First off, I've got my minimum scales set to 0.2, my max to 1 and images are set to 0.7 scale before being added to the TransformManager. Anyways, if I add an item, rotate it 180 degrees clockwise, then resize using the handles on the left of the screen (on the right if it's at 0 degrees rotation), it snaps to the minimum scale in the 0 degrees rotation position. Any ideas?
  4. Aha! The secret was that I don't actually "create" a TransformItem myself. addItem was actually returning one for me! Clever... Anyways yes, that works awesome now and I think it's a great addition to the featureset. Greatly appreciated...
  5. Hi, this sounds great but for some reason, I'm not seeing how I can add this functionality into my app. I'm pretty sure I'm just having a bit of "first day back to work" stupidity but... The way I'm using TM at the moment is to create a new movieclip object, then simply "transformManager.addItem(myMC);" which works but, as far as I can see, these new properties are available only when creating a new "TransformItem" instance, which I can do fine. However, how do I then actually add a TransformItem to my TransformManager? The transformManager.addItem() only accepts DisplayObjects! Again, forgive my stupidity. I'm sure it's very simple but I don't think my coffee's kicked in yet...
  6. Hi there, Ok basically when I add items to my TransformManager, I place them there at 70% but I want to stop the user from scaling them past 100% (and probably stop them scaling them lower than 20% or so too). So far, I haven't seen a property which lets me specify a restriction like this so I thought about using the TransformEvent.SCALE event. However, it just seems to execute once, when the mouse is released. My plan was to check for the scale being greater than 1 and if it is, setting it to 1 but if this event is only fired on release, that's not going to happen. So yeah, basically I'm wondering what approach you would take to this. Is there a parameter lurking somewhere that would just sort this for me? If not, it would be a nice addition to TM as I think a lot of people would like to stop their images from being scaled higher than 100%, degrading the image quality. Maybe a MaxScale/MinScale type option...
  7. Yes, that all makes sense. I've just written a script to sort them. I create an "unsorted" array and pushed objects containing each item in the TransformManager along with it's depth. Then I do an "sortOn" using the depth of each object in the unsorted array and voila, an array respecting the z-index of the items. Maybe something to include in a future update of TransformManager...? I know what you mean by it being a bit sluggish if you had to do that every time but maybe a method we could optionally trigger that would just sort and update everything would be nice.
  8. Sort of... I think the problem is that the array which gets returned from targetObjects doesn't update it's order when you send things back and forward in the z-order. I want to loop through this array in the order of my items z-order, not in the order they were added to the TransformManager as I think it is now. Also, regarding your sprites, I am right in thinking that TransformManager's sprite is ALWAYS at depth 1? When I loop through targetObjects and trace out their indexes, I never get "1" displaying. Maybe I need to do a sort of my array which contains targetObjects by each item's depth each time I grab the data...
  9. Hi there, me again! In a nutshell, I want to grab all of the objects in my TransformManager instance but I want to make sure I've got all the depths correct. I've tried this... var tmObjects : Array = transformManager.targetObjects; for (var i : int = 0; i < tmObjects.length; i++) { trace(itemsContainer.getChildIndex(tmObjects[i])); } ; However this returns odd results including not spitting them out in their correct z-order (although this isn't a biggie, I can sort the array myself). However, the results with two items on stage are often things like "2, 0" (with two items being on stage) or "0, 2". It appears that TransformManager adds an extra Sprite in their somewhere. Am I right? I absolutely love "transformManager.targetObjects" but yeah, either I'm doing something stupid or there's something missing. Basically, I'm just not getting the depths being returned properly. Dave
  10. Ah I've figured that when I click my button, it's automatically deselecting the item so there isn't actually a selected item when my AS is fired. The only way to get it to work that I can see is to set autoDeselect to false. But then I can't deselect my items! I'm going to have to hack around this and add an event listener to pick up on mouse clicks on the stage area the items sit on which will "deselectAll()" If anybody knows of a better way, please do tell!
  11. Hi there, I'm having a strange problem firing the moveSelectionDepthUp()/moveSelectionDepthDown() methods when clicking on a SPRITE in my Flash app. This works: var thisItem : CanvasItem = new CanvasItem(e.droppedItem._itemDataObject); thisItem.x = mouseX; thisItem.y = mouseY; itemsContainer.addChild(thisItem); thisItem.addEventListener(MouseEvent.CLICK, transformEventHandler); transformManager.addItem(thisItem); private function transformEventHandler(e : MouseEvent) : void { transformManager.moveSelectionDepthUp(); } Now, here's what I want to do which is NOT working... button_bringForward.addEventListener(MouseEvent.CLICK, transformEventHandler); Any ideas? I assume it's some kind of a scoping issue but I can't get it sorted. Interacting with the actual items themselves works but nothing else... Thank you very much. I'm loving this tool by the way!
×