Jump to content
GreenSock

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

sdr984

Members
  • Posts

    6
  • Joined

  • Last visited

sdr984's Achievements

0

Reputation

  1. I have moved my reply to http://forums.greensock.com/viewtopic.php?f=3&t=4577 as I think the original question has morphed, and it is more useful in its current state to those using TransformManager.
  2. This is a continuation of a post here http://forums.greensock.com/viewtopic.php?p=18323 which went towards a topic that is better entered in the TransformManager section. The problem I have is that I'm using Flash Builder (SDK 3.5) to use TransformManager to add smaller image on top of a larger image. The problem I have is that I can't seem to find an easy way to tell TransformManager to overlay only ontop of the image itself. Here is my mxml: height="{frame.height-fileUpload.height}" borderThickness="2" borderStyle="solid" borderColor="#071b62" horizontalScrollPolicy="off" verticalScrollPolicy="off" dragEnter="dragAccept(event)" dragDrop="dragDrop(event)"> source="{backgroundSrc}" scaleContent="true" maintainAspectRatio="true"/> verticalScrollPolicy="off" backgroundColor="green"> width="{frame.width}" horizontalScrollPolicy="off" verticalScrollPolicy="off"/> This produces something like this: You can see that the picture on the right is allowed to escape the bounds of the background image. I'd like to be able to say, stay within the bounds of the big image. Another issue is that on resize of the image, the small images don't 'stick' and don't scale with the image: I'm not sure if I should just stretch the background image and keep it a fixed size so that I can accurately determine the placement of the small images. Is there a way to keep the original image proportions and also force transform manager to maintain this as the bounds? Thanks.
  3. It's probably better if I show an actual picture of what I'm talking about in the second part. Sorry it was confusing, I could tell it was as I was trying to describe it. So in mxml if I have something like this I get something like this: Notice that if I ask the Image object for its width, it will not provide the actual width of the bitmap, it provides the width of the image object, which in the demo case above is wider than the actual image width. This is fine if I just want to display the image. However, if I want to add an overlay for drawing ontop of the image I have to figure out how big the image is first. This requires me to 'shrink' the Canvas which contains the image to the image proportions first, then addChild to the canvas to add another drawing canvas on top. This is not easy to do as I have to figure out if the extra space is to the right or the bottom first based on the image proportions. Then I have to shrink it to the image. Then I can add another canvas child with width and height = 100%.
  4. That's strange. Could it be because I'm using flex? I'm testing within Flash Builder 4 and this is a flex app using SDK 3.5. There isn't much that I'm doing apart from the code I pasted in. When I assign to _image, that is assigning to a ByteArray, which you have in your code. That is good that the data comes back on the event. I was looking at the event.data and it was null, so assumed it was not. I see that it is in the target. Here's where things get a little strange. When I debug there is a DataLoader in the target property of the complete event. This has a name of "test". But when I call _image = LoaderMax.getContent("test"); it does not get assigned to the _image var, it stays as null. I guess I could just do event.target.content as you suggest, but wondering why the other does not seem to work. Is it something with scope? The reason why I'm using DataLoader instead of ImageLoader is that sometimes on my imageVO from the server I return the bytes over AMF. I have an existing mxml object in a view which I want to bind to a ByteArray. My logic goes that if the bytes are not returned from the server, I look to load them from a URL. Then I assign those bytes to the ByteArray which is bound to the Image. I'm not sure that the ImageLoader would help with this, but if you have recommendation it would be appreciated. Anther reason I use raw bytes is to keep cached images small. If I loaded as an Image, it converts the jpg bytes I have into a bitmap that is about 30x the size. I keep these loaded bytes in memory cache so I want to keep them as small as possible. The one thing that I haven't used that seems like it would be useful is the resizing tools. I have built my own Canvas to resize the image based on the background. This is kind of how iTunes resizes the videos as you resize the window around it (adjusting black bars on top and bottom to deal with the proportions). The biggest problem I ran into is that when you ask the image what size it is, it reports back the size of the canvas. I have canvases that I want to put ontop of the actual visible image (not what the Image object reports back as size, which is the size of the backing Canvas). So I look at the proportions of the image when it first comes in. Then on a resize event I change the Image wrapping Canvas to be the same size as the actual image. This allows me to put another drawing canvas ontop of the Image without having to worry about it creeping into the 'black bands'. Hopefully that makes sense. Do any of the loading tools allow for this use case?
  5. I see that the LoaderMax class provides a lot of ease when adding a loaded image to the stage. I have a situation where I have existing code where I have a URL, or bytes in an object that represent an image. If the bytes are there I load them (unfortunately in actionscript this is async even when bytes in memory). If the URL is used, I store the bytes so they are loaded quickly the next time (lazy load and cache). I'm having a problem where using the data loader the image is not even loading. I have included the code below: public function loadImageBytes(callback:Function, sessionId:String=null):DataLoader { this.imageBytesCallback = callback; if (_image == null && publicURL != null){ var loadName:String = "test"; //id+"-"+new Date().getTime(); //what i want this id to be so unique var alternateURL:String = null; publicURL = "http://www.greensock.com/wp-content/themes/greensock/images/greensock_member_on.png"; var loader:DataLoader = new DataLoader(publicURL, {name:loadName, format:"binary", estimatedBytes:25000, autoDispose:true, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); loader.load(); attemptedLoad = true; return loader; } return null; } function completeHandler(event:LoaderEvent):void { trace("complete "+event.text); _image = LoaderMax.getContent("test"); imageBytesCallback(this); } When this returns to _image the result is null (even though this image is obviously there if you go to the URL). A few questions. I want to have the loader have a unique Id every time, however it seems that this was created to add the LoaderMax object to the stage instead of extracting out the raw bytes, and binding them to an Image object on the stage. Is that true, and is there any way to extract the bytes to the containing object? Would you recommend instead just having the LoaderMax object on the stage instead of an Image object? It seems problematic that the completeHandler must know the content name of the LoaderMax. Doesn't this become an issue if you line up many images in a row to load as I'm planning on doing. The function only knows the Id if I include it within the scope of the function creating the LoaderMax. This means I can't pass the DataLoader back to the caller and allow it to wait on the complete event because it won't know what the content name is. Is there a way around this, or am I trying to use the class incorrectly. Thanks for a great product. I have been using TweenLite and TransformManager and they have been great.
  6. I am trying to implement Apples streaming video standard (http://tools.ietf.org/html/draft-pantos-http-live-streaming-04) in as3. Essentially I load a list of video meta data, then load each individual video and play them sequentially. This seems to be exactly what this loading library supports. However, when multiple video files are attempted to be stitched together there always seems to be a small gap where the video pauses between the subsequent video play requests. Lei Zhu has an excellent example of this deficiency illustrated here where he has created his own loading queue for the video http://video.leizhu.com/video.html. Since this library seems to make up for deficiencies in the out of box loaders (I have logged a bug against Adobe as I believe there is something wrong on their side as no one seems to know how to fix this https://bugs.adobe.com/jira/browse/FP-5355), I'm wondering is you have had success in video stitching using this library? Thanks!
×