Jump to content
GreenSock

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

rjForbes

Members
  • Posts

    3
  • Joined

  • Last visited

rjForbes's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi there, I have been playing with BlitMask and have it working but with a caveat. I am creating some flow based objects (pipes, data links) for a training module, and I am setting them up as objects that can be placed on the stage and scaled dynamically. For example, you could drag a pipe from the library on the stage that is 20px high X 200px wide and scale it to 20px high X 800px wide to start building a pipe flow. You would continue to add pipes and connections and varying lengths until the system is built. When the custom flow function is called for that pipe, it determines the new scaled width of the object and scales the animated flow content accordingly. This works fine normally with masks and dynamic objects. So i started to try and implement BlitMask for this to take advantage of the performance and it works, but the graphic quality is low. Im assuming this is because it is using its original object dimensions and not the scaled one. Here is the code for a simple data link flow I am using to try and implement this. It is for a Object that is initially 200px X 20px then scaled: //************* Main Flow Function *************\\ public function flow(speed:Number = 1):void { // Setup scaling based on layout if (this.width > this.height) { scale = 200 / this.width; amount = (this.width / offset) + 3; } else { scale = 200 / this.height; amount = (this.height / offset) + 3; } // Remove flowContainer if it already exists; if (flowContainer != null) { removeChild(flowContainer); } // Create flowContainer for clips, add to stage flowContainer = new Sprite(); addChild(flowContainer); var blitMask:BlitMask = new BlitMask( flowContainer, flowContainer.x, -10, 200, 20, true, true, 0xffff00, true); // Scale the flowContainer, offset its x value flowContainer.scaleX = scale; flowContainer.x = -offset * scale; //Add Data links to animate for (var i:int = 0; i { var dlc:Data_Link_Clip = new Data_Link_Clip(); dlc.x = i * offset; dlc.y = 0; dlc.cacheAsBitmap = true; dlc.cacheAsBitmapMatrix = dlc.transform.concatenatedMatrix; if (speed < 0){ dlc.scaleX = -1; }else{ dlc.scaleX = 1; } flowContainer.addChild(dlc).name = "dataLinkClip" + i; } // Set Timing speed, convert negative to positive values var timep:Number = Math.abs(speed); // Set Direction based on negative or positive value var dirp:Number; if (speed > 0){ dirp = 0; }else if (speed < 0){ dirp = (-2 * offset) * scale; }else{ dirp = 0; } // Animate horizontally for data clips TweenMax.to(flowContainer,timep,{x:dirp, repeat:-1, ease:Linear.easeNone}); } // End Main Flow Function
  2. Thanks Jack, I knew it had to be something simple. I thought i had tried to addCHild before , but then had taken it out thinking the attach function was doing that for me. The liquidStage class is really cool, looking forward to working with it in this project.
  3. HI All, I'm just getting started with LiquidStage and I am having a issue with it seeing objects that are added to the stage dynamically. I may be overlooking something obvious here, but this is whats happening. If I add a new object and attach it to the ls like this: var header:infHeader = new infHeader(); ls.attach(header, ls.TOP_LEFT); I receive this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.greensock.layout.core::LiquidData() at com.greensock.layout::LiquidStage/attach() at contendo::Interface/buildInterface() at contendo::Interface() If the 'header' object was on the stage though with the 'header' instance name it works though. Any help is appreciated, RJ
×