Jump to content
Search Community

Sam

Business
  • Posts

    24
  • Joined

  • Last visited

Posts posted by Sam

  1. Thank you Zack. That did help. I'm glad to hear that I didn't make a poor chose with what to call in GSAP. Any other tips would be appreciated.

     

    As for GSAP 3, what I have seen of it has me excited. I might do a performance profile of this same use case implemented in GSAP 3 to see if there's any boost. 

    • Like 1
  2. Hi Guys, 

     

    I'm another AS3 GSAP guy whose been lurking around for ages. I've always appreciated the work that Jack and the others do so... Thanks. 

     

    Without further ado, I recently took on a project wherein some brand images are bouncing around in the background of a page. I produced the code that is in the attached Codepen but I am seeing my CPU/GPU usage spike when leaving the page idle. I thought that I'd better check with the gurus before releasing something that's going to kill some nice ladies phone. 

     

    1000 foot view is that on init I build a container full of image elements with SVGs for their src and prime them with their first animation. The animations are to (somewhat) random x pos, y pos, scale, opacity, and rotation.  I am using the callback at the end of the animations to trigger getting a new animation and each is 30 to 60 seconds long. So my code only gets touched once every 30-60 seconds per icon. The random calculations are all simple arithmetic with a minimum number of calls to Math.random();

     

    Help Please! Am I doing something terribly wrong? Should I be throttling something somewhere?

     

    Thanks in Advance!

     

    See the Pen WNNGjzK by lilolbear (@lilolbear) on CodePen

  3. For the scale, I have added to the updateScale method in the TransformManager:

    		/** @private **/
    		private function updateScale($x:Boolean = true, $y:Boolean = true):void {
    			var ti:Object = _trackingInfo; //to speed things up
    			var mx:Number = _parent.mouseX - ti.mouseOffsetX, my:Number = _parent.mouseY - ti.mouseOffsetY;
    			if (_bounds != null) {
    				if (mx >= _bounds.right) {
    					mx = _bounds.right - 0.02;
    				} else if (mx <= _bounds.left) {
    					mx = _bounds.left + 0.02;
    				}
    				if (my >= _bounds.bottom) {
    					my = _bounds.bottom - 0.02;
    				} else if (my <= _bounds.top) {
    					my = _bounds.top + 0.02;
    				}
    			}
    			
    			if ( _snapScaleTo )
    			{
    				mx = (((mx + (_snapScaleTo / 2)) / _snapScaleTo) >> 0) * _snapScaleTo;
    				my = (((my + (_snapScaleTo / 2)) / _snapScaleTo) >> 0) * _snapScaleTo;
    			}
    
    

    The _snapScaleTo variable is a public Number that I added as well. Whenever snap is turned on or the size of the grid is changed I update the transformManager.snapScaleTo to equal the grid value and set it to 0 if the grid or snap are turned off.

    • Like 1
  4. First off, thanks for this. It was exactly the breadcrumbs that I needed to get a snap to grid function working. The transformManager appears to have a public updateSelection() method now so all that was required to get it function for position was to listen for the TransformEvent.MOVE, adjust the position and update the selection.


     


    Where I'm running into challenges is getting the snap to work on the TransformEvent.SCALE. Adjusting the display object, like in the move above, doesn't adjust the TransformManagers handles. So the display object snaps to the scale but the handle position remains unadjusted and is out of position with the display object. Any suggestions?


  5. Hello again!

     

    I am looking for more precise control over the positioning of an asset in the FlexContentDisplay when the scalemode is set to one of the proportional options. Currently there are options to set the position by alignment. Your VAlign and HAlign stuff. I'd like to be able to grab the image and drag it to a position withing the bounding box. I imagine it's someting like getting access to the wgap and vgap but I am not sure if there are pitfalls to this that I am not seeing. 

     

    Can you help?

  6. I am trying to access the SampleDataEvent for a sound that has been loaded by the MP3Loader. I had assumed that this would be as easy as adding an event listener to the content of the loader like so:

    
    ( ( _loader as MP3Loader ).content as Sound ).addEventListener( SampleDataEvent.SAMPLE_DATA, onSampleData );
    
    

    ... but I am not seeing any events.

     

    Help Please

  7. I am trying to use the TransformManager in combonation with the LoaderMax ContentDisplay. In my application I expose the ContentDisplay scaleMode options to the user (ProportionalInside, ProportionalOutside, and Stretch).

     

    Attaching the TransformManager to the ContentDisplay works just fine for rotation and position but it is misleading for scale. The TransformManager scale warps the ContentDisplay. When the ContentDisplay scaleMode is set to Stretch this makes perfect sense but when the ContentDisplays scaleMode is set to either of the Proportional settings it seems like it should change the bounding box width instead. That way the image continues to fill maintain proportion according to the scaleMode.

     

    I attempted the TransformManagers constrainScale and this guarantees that the original fitHeight and fitWidth aspect ratio are maintained which helps in the cases where the scaleMode is set to proportional but sacrifices the ability to change the shape of the bounding box.

     

    I guess that is my question: Is there a way to make the TransformManager change the ContentDisplay bounding box?

     

    Thoughts, feelings, assistance?

  8. Adobe just release 11.2 of the flash player that appears to really mess up the seek function on netstream objects. I didn't delve very far into the issue but I wrote a little test app to confirm the issue. I have attached the project to help.

     

    The summary is that I tested seeking to each frame of a video in a loop and got the following results:

     

    -----------------------------------------------------

    flash version: MAC 10,3,183,18

    -----------------------------------------------------

    complete - ready to loop through seek on 1273 frames

    starting seek through video at: 4614

    ending seek through video at: 4617

    total time: 3ms

    starting seek through video at: 6907

    ending seek through video at: 6910

    total time: 3ms

    starting seek through video at: 9134

    ending seek through video at: 9137

    total time: 3ms

    starting seek through video at: 11349

    ending seek through video at: 11353

    total time: 4ms

     

    -----------------------------------------------------

    flash version: MAC 11,1,102,64

    -----------------------------------------------------

    complete - ready to loop through seek on 1273 frames

    starting seek through video at: 4288

    ending seek through video at: 4291

    total time: 3ms

    starting seek through video at: 6560

    ending seek through video at: 6563

    total time: 3ms

    starting seek through video at: 7045

    ending seek through video at: 7048

    total time: 3ms

    starting seek through video at: 7752

    ending seek through video at: 7754

    total time: 2ms

     

    -----------------------------------------------------

    flash version: MAC 11,2,202,228

    -----------------------------------------------------

    complete - ready to loop through seek on 1273 frames

    starting seek through video at: 2528

    ending seek through video at: 3443

    total time: 915ms

    starting seek through video at: 5690

    ending seek through video at: 6629

    total time: 939ms

    starting seek through video at: 8136

    ending seek through video at: 9064

    total time: 928ms

    starting seek through video at: 10419

    ending seek through video at: 11347

    total time: 928ms

     

    Hope this helps.

  9. Couldn't hurt to ask. I am doing option 1 but I have to completely override the _update call so I am essentially copying that function and then removing that piece. A little easier than merging but still with the some maintenance concerns. #2 is undesirable for a slew of reasons that are unique to my situation.

     

    Anyhow, thanks for the fast reply.

  10. Hi Jack,

     

    I'd like to make a feature request for the FlexContentDisplay & ContentDisplay classes. In your _update call you are drawing a, normally transparent, rectangle:

    		protected function _update():void {
    		var left:Number = (_centerRegistration && _fitWidth > 0) ? _fitWidth / -2 : 0;
    		var top:Number = (_centerRegistration && _fitHeight > 0) ? _fitHeight / -2 : 0;
    		graphics.clear();
    		if (_fitWidth > 0 && _fitHeight > 0) {
    			graphics.beginFill(_bgColor, _bgAlpha);
    			graphics.drawRect(left, top, _fitWidth, _fitHeight);
    			graphics.endFill();
    		}

    I remember something from the docs about this being to insure mouse interactions would function properly. My request is to have a var that tells it *not* to do this. I would like to draw these backgrounds myself but updates were interfering. I extended the class but it sure would be nice to not have to check/maintain it each time I update my greensock. My thoughts are something like:

    		protected function _update():void {
    		var left:Number = (_centerRegistration && _fitWidth > 0) ? _fitWidth / -2 : 0;
    		var top:Number = (_centerRegistration && _fitHeight > 0) ? _fitHeight / -2 : 0;
    		if ( !manualBg )
    		{
    			graphics.clear();
    			if (_fitWidth > 0 && _fitHeight > 0) {
    				graphics.beginFill(_bgColor, _bgAlpha);
    				graphics.drawRect(left, top, _fitWidth, _fitHeight);
    				graphics.endFill();
    			}
    		}

    With the appropriate getters and setters for manualBg. I can pass along what I have done if you like but I assume you'd like to do it your own way.

     

    Thanks!

    Sam

  11. Thanks for the info Jack, I'm not complaining, just trying to understand where my time is going. It does look like the profiler must include the netstream in their [tincan]. I profile my app without videos and the [tincan] method goes away. I have gone through a bunch of optimization and have managed to increase the [tincan]s consumed time to around 80%. In some cases the app is trying to play 3+ videos simultaneously maintaining some sync so it's no big surprise that load for decompression would be high.

     

    BTW, I am highly disappointed in the lack of low level hooks that the netstream gives for operating between iframes. I would have expected a step operation there. Another glaring hole seems to be a settable FPS. Everything my research has turned up thus far in these areas looks like these *might* be possible if I am willing to invest in a FMS and only handle content that I serve from there.

  12. Hi Jack,

     

    This is more of a grasping at straws question. I am profiling an application that I have using loaderMax for all of the load and display of images and videos. We are having issues with the framerate dropping into the single digits and are trying to track down the issue. The profiler (flex) claims that >50% of the cumulative time spent is in a method cryptically named "[tincan]". Googling around dug up the following:

    The tincan method is the time processing RTMP messages. It includes FMS video/audio traffic, rtmp data services, and remote shared object synchronization. Tincan used to be the code name of Flash Communication Server 1.0, now known as Flash Media Server.

    Information on this is pretty sparse so I am not sure how much I trust it to not be a dozen guys all quoting each other but I have not found another explanation and it's at least consistent with the profiler doc on bracketed methods (http://help.adobe.com/en_US/flashbuilder/using/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7edf.html).

     

    The reason I brought this to your door is that I was lead to believe that the loaderMax library would not use the RTMP methods. So either they were incorrect or I am doing something I shouldn't be in my code. Either way, I am at an impasse. I'd like to figure out where half my time is going. Am I using your library incorrectly? Does tincan include the base netstream and video objects?

     

    Any hints you could provide, or directions you could set me off in would be useful. Thanks!

  13. Hello again,

     

    Looks like you have a null object reference issue when a loader path and defined alternateUrl both fail and the dispose call is made on the loader instance. I attempted to attach a demonstration of it but the forums gave an error: Sorry, the board attachment quota has been reached. Should be pretty easy to replicate but if you're interested in the demo give me a place to drop it and I can shoot over the project.

     

    Main Thread (Suspended: TypeError: Error #1009: Cannot access a property or method of a null object reference.)	
    com.greensock.loading::VideoLoader/_dump	
    com.greensock.loading.core::LoaderItem/set url	
    com.greensock.loading.core::LoaderItem/_failHandler	
    com.greensock.loading::VideoLoader/_statusHandler	
    

     

    Sam

  14. Yep. I was looking at reproducing the issue, where a video would hang when a user clicked restart or play / pause a couple times, in an example for you but have not been able to isolate it. I suspect I am doing something to 'help' the flex component that I may not need any longer.

     

    If I discover something I will pass it along.

     

    Thanks for your time.

  15. Not just paused, really I am looking for playable but not playing. I have run into a number of cases where the video slips off the rails and needs to be prompted to get back to the correct frame and play. Particularly if you tell the player to seek or pause often. Try it.

     

    I have been delving a little bit deeper into what the mediaPlayerState is doing and it's all coming from the org.osmf.media.MediaPlayer which is just an EventDispatcher wrapper on the media. It looks like there is several layers of logic that sit on top of the net loader. Have you done any experiments with the osmf libraries?

  16. Hi Greensock,

     

    I was looking over using your VideoLoader as a replacement for the spark VideoPlayer and had some questions for you:

     

    1) I was not able to find an equivalent to the mediaPlayerState call on the VideoPlayer. I am using this to verify that the video is acting appropriately in conjunction with other motion on the stage. I periodically inspect it to make sure it has not slipped into an unexpected state, particularly something other than 'playing' once I have told it to play. Am I just missing your version of this?

     

    2) Failing to get the high level view into the player state, is there an accessor that I could use to push the loaded video into the spark video player? I like the loader itself and am forcing the videos to be fully downloaded before allowing their use. My little glance at this didn't yield promising results though.

  17. Hi greensock,

     

    I have a project wherein I am loading videos and allowing the user to adjust the scale mode similar to the way the autofitarea example works. I believe that I have discovered a bug in your FlexContentDisplay class (and possibly ContentDisplay). When setting the ScaleMode on the object to STRETCH it will not return to either proportional mode unless you set it to NONE first. I have attached a brief project that demonstrates the bug.

×
×
  • Create New...