Jump to content
Search Community

Chris7777

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by Chris7777

  1. Actually just one more question - again. I noticed that in LoaderItem::_failHandler() that the order was rearranged (error handler first, then update url), but not in LoaderItem::_auditStreamHandler() - would there be any harm rearranging the order in that one too? Thanks
  2. Sorry I didn't even think to grab the latest version. Thanks for letting me know that it was addressed in there. As always, a fantastic library of code. I let my Club Greensock expire by accident, but considering you're always ready to help I will need to register again for another year (just have to wait for next pay day ) Thanks again Jack
  3. Sorry to be a pain, but I just realised this is a slightly bigger than originally thought, as I need a way to determine if the function onError is handling an error from the primary URL or the alternate URL - originally I was going to use the e.target.url, but this is updated before the event is dispatched. Is there any way around this? Cheers
  4. Hi, I have noticed when outputting e.text from an onError function callback the information displayed refers to the alternateURL not the actual URL that is error'ing. Example: var loader:SWFLoader = new SWFLoader("primary_child.swf", { name:"mainSWF", container:this, onFail:onFail, onError:onError, alternateURL:"alternate_child.swf" }); //begin loading loader.load(); function onFail(e:LoaderEvent):void { trace("Page Load Fail:: Details: " + e.text + " " + e.target); } function onError(e:LoaderEvent):void { trace("Page Load Error:: Details: " + e.text + " " + e.target); trace("Attempting to load alternate url"); } And the error output is: ---- Loading error on SWFLoader 'mainSWF' (alternate_child.swf): Error #2035: URL Not Found. URL: file:///E|/testing%20grounds/load/primary_child.swf ---- Page Load Error:: Details: SWFLoader 'mainSWF' (alternate_child.swf) > Error #2035: URL Not Found. URL: file:///E|/testing%20grounds/load/primary_child.swf SWFLoader 'mainSWF' (alternate_child.swf) Attempting to load alternate url I have had a look at LoaderItem.as, and noticed that in the _failHandler, the this.url is updated to the alternateURL, then calls the errorHandler function. Which means it outputs '(alternate_child.swf) > Error', rather than '(primary_child.swf) > Error'. It's not big deal because it does display the url failing just below, but if it's just a matter of swapping the order of those 2 lines, it might be cool? Or does it break a bunch of other stuff?? From 'LoaderItem.as' /** @private **/ override protected function _failHandler(event:Event, dispatchError:Boolean=true):void { if (this.vars.alternateURL != undefined && this.vars.alternateURL != "" && !_skipAlternateURL) { //don't do (_url != vars.alternateURL) because the audit could have changed it already - that's the whole purpose of _skipAlternateURL. _skipAlternateURL = true; _url = "temp" + Math.random(); //in case the audit already changed the _url to vars.alternateURL, we temporarily make it something different in order to force the refresh in the url setter which skips running the code if the url is set to the same value as it previously was. this.url = this.vars.alternateURL; //also calls _load() _errorHandler(event); } else { super._failHandler(event, dispatchError); } }
  5. Hi, I am using the CirclePath2D class and want to change the height of the circle (to create an oval shape). This needs to happen prior to being added to the stage. Using the following code, you can see the height can only be altered after the CirclePath2D has been added to the stage. Unlike Shape which CirclePath2D inherits from which can have its height altered prior. I looked at the CirclePath code, and it looks like this is because no rendering takes place prior to it being added to stage. Is there any way around this, possibly extend CirclePath2D? Thanks // Paste this code into a empty flash doc and see how the 2nd and 3rd appears but the first doesn't import com.greensock.motionPaths.*; import flash.display.Shape; // Example 1 - Fails var circle:CirclePath2D = new CirclePath2D(0, 0, 50); circle.height = 25; // Before circle.x = 50; circle.y = 50; addChild(circle); // Example 2 - Works var circle2:CirclePath2D = new CirclePath2D(0, 0, 50); circle2.x = 50; circle2.y = 100; addChild(circle2); circle2.height = 25; // After // Example 3 - Works var shape:Shape = new Shape(); shape.graphics.lineStyle(1, 0x00FF00); shape.graphics.drawCircle(0, 0, 50); shape.height = 25; // Before shape.x = 50; shape.y = 150; addChild(shape);
  6. Hi Jack, I've just started retro-fitting LoaderMax into an existing project which loads several SWF's into a master SWF. I've found a few things though, which I didn't pick up when I was doing the beta-testing. Question 1 - SWF Alignment Let's say a child SWF's stage width and height is 900 x 490 and I have a box (say 100px x 100px, topleft aligned) located at 200, 200. I.e there is a gap of a 200 from the left of the box to the stage left edge, and a 200px gap from the top of the box to the stage top edge. In the master SWF I (let's assume I am only loading in 1 child at the moment) I run this: var loader:SWFLoader = new SWFLoader("child.swf", {container:this, width:900, height:490, scaleMode:"none", centerRegistration:false}); The result is the box is 'pushed' all the way to 0, 0. I understand that a published SWF looses its stage to the parent, because only 1 stage can exist, but is there a way to stop this? I understand I could technically place a massive white background on the stage and republish all the children, but I was hoping there might have been a away around this. Question 2 - SWF Cropping This is actually more a request (I know you were asking for requests before release but I didn't think of this at the time My bad). Is it possible to have some sort of crop, similar to your layout tool. For example, I set the SWFLoader to again height:900, width:490, and maybe (??) set crop:true and it will crop any of the loaded child SWF outside of these dimensions? Thanks [Resolved] Update: I combined your AutoFitArea with the SWFLoader as such. // Container for var container:Sprite = new Sprite(); addChild(container); // 900 x 490 is my desired widths and heights. var area:AutoFitArea = new AutoFitArea(_mc, 0, 0, 900, 490, 0xFFFFFF); area.preview = true; var loader:SWFLoader = new SWFLoader("child.swf", {container:container, centerRegistration:true, onComplete:onComplete}); function onComplete(e:LoaderEvent):void { area.attach(e.target.content, ScaleMode.NONE, AlignMode.CENTER, AlignMode.CENTER, true); } Thanks Jack. I'm not sure where to note this but in the SWFLoader docs under the property 'status' summary that 'LoaderStatus.COMPLETE' but its actually LoaderStatus.COMPLETED.
  7. Yes exactly - as any display object can only exist on one display list. In the end, missing.jpg was stored in the library as BitmapData (I could load it in as unique one off at the start of the queue though). In terms of LoaderMax, it handled everything easily! - It was as if all the items were pretty much stored in the library ready to go, I didn't really have to think about it. (which is want you want from a Loading Platform). It was quite interesting to feed the File nativePath property directly into ImageLoader to bring in images from the drive straight into the Air app. Could lead to some very powerful stuff. I included some sample code of what I was using LoaderMax for - I just wanted to create a mini media browser. Obviously needs a lot of work, but a good proof of concept. import flash.filesystem.File; import flash.events.FileListEvent; import com.greensock.*; import com.greensock.loading.*; import flash.events.*; // The 2 dir's var movieDir:File = new File("F:/movies/"); var thumbnailDir:File = new File("F:/movies/_thumbnails/"); // Get files in dir's var movieArray:Array = movieDir.getDirectoryListing(); var thumbnailArray:Array = thumbnailDir.getDirectoryListing(); // Sort them into alphabetical order movieArray.sortOn("name") // Store length in int's to same looking up everytime var numMovies:int = movieArray.length; var numThumbnails:int = thumbnailArray.length; // Create queue var queue:LoaderMax = new LoaderMax({onComplete:completeHandler}); var container:Sprite = new Sprite(); stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE; // Populate if the movie isn't a directory, and isn't that annoying Thumbs.db. // movie.avi will match to movie.jpg (hence the substrings) if(movieDir.exists && thumbnailDir.exists) { for(var i:int = 0; i < numMovies; i++) { if(movieArray[i].name != "Thumbs.db" && !movieArray[i].isDirectory) { for(var j:int = 0; j < numThumbnails; j++) { if(movieArray[i].name.substr(0, movieArray[i].name.lastIndexOf(".")) == thumbnailArray[j].name.substr(0, thumbnailArray[j].name.lastIndexOf("."))) { queue.append(new ImageLoader(thumbnailArray[j].nativePath)); } } } } } // Once populated - load queue.load(); function completeHandler(event:Event):void { var tb:Sprite; var t:TextField; var tf:TextFormat = new TextFormat(); tf.font = "Myriad Pro"; // Embed Font in library exported to AS as MyriadPro tf.size = 20; tf.color = 0xFFFFFF; for(var i:int = 0; i < numMovies; i++) { tb = queue.getContent("F:\\movies\\_thumbnails\\" + movieArray[i].name.substr(0, -4) + ".jpg"); if(!tb) { tb = new Sprite(); tb.addChild(new Bitmap(new Missing())); // Missing contained in library as jpg extending BitmapData } // Position thumbnail tb.width = 100; // Set thumbnail size (as jpg's vary) tb.height = 200; tb.y = (200 + 10) * i; // Setup text t = new TextField(); t.defaultTextFormat = tf; t.embedFonts = true; t.autoSize = TextFieldAutoSize.LEFT; t.text = movieArray[i].name.substr(0, -4); t.y = (200 + 10) * i + 60; t.x = 150; // Add thumbnails and text to container container.addChild(t); container.addChild(tb); } addChild(container); // Once loaded, handle interaction container.addEventListener(MouseEvent.CLICK, handleClick, false, 0, true); stage.addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true); } // Click opens the movie with the default ap (VLC in my case) function handleClick(e:MouseEvent):void { movieArray[int(container.mouseY/200)].openWithDefaultApplication(); } // Rolling the mouse tweens the container up and down (no upper boundary) function handleWheel(e:MouseEvent):void { var v:Number = container.y + (e.delta * 70); if(v > 0) v = 0; TweenLite.to(container, 0.5, {y:v}); } I guess its worth noting, considering this is about LoaderMax that all it took was 2 lines of code to load in hundreds of images the constructor line (new LoaderMax) and the append line (queue.append) Thanks Jack - when are Adobe giving you a job already?
  8. As a test for loader max, i started building a small air app (i thought it would be interesting to test in a non typical flash environment). The app reads my external hard drive for all movie files, and then checks a particular folder for their thumbnail, based just on filenames (i.e. Movie A.avi = Movie A.jpg). Pretty simple stuff. The folder contains approx. 250 movies, but only approx. 100 images, so where the image wasn't found, I wanted to load a "missing.jpg" image. A generic image. So simple pseudo code loop through each movie loop through image directory if image found then queue.append(new image loader(image path)) else queue.append(new image loader(missing image path)) end loop end loop process queue This could obviously be done multiple ways. Actually probably a lot more efficient to load the missing image once, then not append if the image isn't found, but that isn't the point. My question is, that is appears that it attempts to load the missing image every time. I'm pretty sure flash automatically cache's loaded resources, but how does loader max handle multiple loads of the same resource? Just out of interest?
  9. 1 - 7k min to 14.75k max is nothing in my opinion. I think that your goal of keeping things small is great, and should always be a consideration when developing for the web, but anything loaded in, is almost guaranteed to be larger than the library itself (mp3's, images..). This may be obvious, but percentage wise, your library is trivial in size compared to what it will be loading in. With your tweening libraries, size was far more important - because there is a good chance they would've been used in super small swf's such as banner ads, etc. 2 - No. Yes. Yes 3 - I think CHILD_ is fine, as ricewing said, DECENDENT_, I mean DESCENDANT_ will most likely lead to spelling mistakes. CHILD isn't too much of a stretch in terms of naming, although CHILD doesn't imply grandchildren, great-grandchildren, and so-forth. Personally I would much rather CHILD_ as it's quicker to type. 4 - Nope 5 - As long as it follows the same Terms of Use as the Tweening Platform (which I believe you said it will), no. 6 - It offers another level of abstraction that is built from the ground up for generic use. Developing my own loading procedures always ends up with the loading code becoming far too coupled to the main program for my liking. LoaderMax is coming from a proven coder (thanks to the Tweening Platform) so my own code can concentrate on doing its job, rather than checking is File1 loaded, oh is File2 loaded, oh and by the way is File3 loaded, etc. Thanks
  10. Hi, Just a quick question that we are trying to workout based on the documentation. Does the distribute function handle 0 & 1 differently than the progress function? I am finding that path.distribute(mcArray, 0, 1) works as expected. mcArray[0] at the start, mcArray[1] at the middle, and mcArray[2] at the end. But the minute I tween the paths property progress to say 1, two of the mc's overlap. Please see the stripped down version of the documentation code below: Note that the array contains 3 mc's, but 2 are overlapped. I also tried the documentation version (the 30 blue squares with the 1 red square) and found that is i changed the alpha of the blue cubes to, say 0.5, you can clearly see that two are overlapped. Any help would be great, thanks. import com.greensock.*; import com.greensock.motionPaths.*; import com.greensock.easing.*; var path:LinePath2D = new LinePath2D([new Point(20, 20), new Point(300, 300)]); addChild(path); var a:Array = [createSquare(), createSquare(), createSquare()]; path.distribute(a, 0, 1); TweenMax.to(path, 5, {progress:1, ease:Linear.easeNone}); function createSquare():Shape { var s:Shape = new Shape(); s.graphics.beginFill(0xFF0000, 1); s.graphics.drawRect(-10, -10, 20, 20); s.alpha = 0.5; s.graphics.endFill(); this.addChild(s); return s; }
  11. Hey mate, thanks for the quick reply. I will look into the details you mentioned. Thanks again,.
  12. Hey, how's it going? As always great engine! Its still the only actionscript engine/library I have ever purchased (not sure if its linked to my forum account but i am a greensock member, and am proud of it). Anyway, I am building a gallery that loads an external SWF, and on clicking "next", I tweenlite a bitmapped clip (see below) onto the stage (x,y values). I want to load in infinite items, so as each leaves, they are destroyed. The SWFs loaded in can be very complicated so I use bitmapdata to "draw" the movieclip, then create a bitmap based on that, then add that bitmap to a movieclip and tween that in. On tween complete I remove the bitmapped version of the movieclip, and swap in the real movieclip. I find that after several "next"s the framerate drops massively during the tween (then bounces back up to the correct frame rate on completion), now this is most likely due to a leak in my code somewhere, BUT, I was wandering what is the best way of dealing with large or complicated movieclips when tweening? Should i be drawing them out as above, or something else? I do stress, the slow down is my fault somewhere, nothing to do with the greensock engine.
×
×
  • Create New...