Jump to content
Search Community

Tracing & debugging

ShortBus test
Moderator Tag

Recommended Posts

Hello folks-

 

First off I want to congratulate y'all on the great Greensock project! I'm new to ECMA scripting and learning on a daily basis.

I wrote a small app in native AS3 that works like a tiny XML gallery with thumbnails & magnifying glass for a friends website. It only will have 2-4 images when in production as it's a product display app. The images that load are 1500x1500 so I've been working with SWFs for reduced file size. My original works alright but I needed something to bulk load, thus finding LoaderMax. I also ended up with 5 separate loaders, probably because I'm such a newb.

 

I'm looking for the best ways to troubleshoot so I don't do so much trial & error (which there's plenty of already, LOL).

For instance, in my test app I'm using XMLLoader & calling SWFLoader in the XML file to load 4 SWFs. On the queue complete my function adds a child "image1" using the getContent method as "image4" ends up being the top most image (child?). Am I thinking about this the wrong way or shouldn't there be 5 objects (children?) now? My trace trying to find numChildren shows 1 object Sprite. My traces of onChildComplete show the 4 images. My numChildren trace looks like this right now.

for (var i:uint = 0; i < this.numChildren; i++){trace ('\t|\t ' +i+'.\t name:' + this.getChildAt(i).name + '\t type:' + typeof (this.getChildAt(i))+ '\t' + this.getChildAt(i));}

And the output is

	|	 0.	 name:progressBar_mc	 type:object	[object MovieClip]
|	 1.	 name:progressBar_txt	 type:object	[object TextField]
|	 2.	 name:instance2	 type:object	[object Sprite]

 

I have many, many questions but this should break the ice & help me along my way.

Anything that'll help a poor old newb would be greatly appreciated :mrgreen:

Thanks, Karl

Link to comment
Share on other sites

if the XMLLoader is loading an XML file that has 4 SWFLoaders, the XMLLoader will have 4 children

 

put this into your XMLLoader complete handler:

 

trace("evertything loaded");
trace("children of XMLLoader " + event.target.getChildren());
trace("number of children of XMLLoader " + event.target.getChildren().length);

 

in the above event is the LoaderEvent that is being passed to the function as in: function queueComplete(event:LoaderEvent){}

 

your argument name may vary

 

without seeing more code or xml it will be very difficult offer any more assistance. perhaps you can upload your files with small images if you need more help.

Link to comment
Share on other sites

Hi Carl, thank for the reply.

 

I don't know if you are part of the development team at GS but kudos to you & all you do in this forum. I enjoy your snorkl site & have it bookmarked for constant reference.

The traces you supplied did confirm 4 children, thx :D

evertything loaded
children of XMLLoader SWFLoader 'image1' (images/image1.swf),SWFLoader 'image2' (images/image2.swf),SWFLoader 'image3' (images/image3.swf),SWFLoader 'image4' (images/image4.swf)
number of children of XMLLoader 4

I forgot to mention in the prior post that I was spending some time at snorkl.tv & I was working off your tuts on LoaderMax & XMLLoader. You probably don't need to see your code agan. I just stacked the images in one of my changes. It took me a while to figure out how to load SWF from your examples, then I picked it up on LoaderMax tip&tricks. I used the XML to call SWFLoader, which I think is a pretty dang spiffy option

<?xml version="1.0" encoding="iso-8859-1"?> 





I did change up the queueCompleteHandler to pull "image1" to the front, but I see now it "referred to?". That's where I was thinking another child was added (quite newb, remember)

function queueCompleteHandler(event:LoaderEvent):void{
progressBar_mc.visible = false;
progressBar_txt.visible = false;
var queueLoaded = LoaderMax.getContent("image1");
spBoard.addChild(queueLoaded);
TweenLite.to(queueLoaded, 2, {alpha:1});
}

This project I'm working on seemed kind of simple at the onset but I'm seeing it's got weight. Essentially I'm looking to get is an app that effectively works like a simple S c e n e 7 product display with view choices & zooming/magnification. The big issue has always mostly been the zoom aspect (I spent a month [on & off] on the version that works now, LOL) It's all good and I'm learning all the time.

 

Again, thanks for the help, I'm working on doing an array & thumb calls now.

Karl

Link to comment
Share on other sites

Hello Karl,

 

I'm not part of the development team (that would be disastrous), but as you can see I do my best to offer support.

 

I'm very glad to see that my tutorials have helped you get started. I've only recently started using LoaderMax. I've found that although the documentation is stellar, there are so many options / features to mix and match that it can be a bit overwhelming at first. I noticed on this forum that a lot of people just need a little push in the right direction. Learning LoaderMax is a bit more involved than the TweenLite family of tools. When answering questions here I found myself always digging through the documentation and then building little demo files to test the solution. I realized for myself that it was very helpful to have a series of files laying around that simply:

 

load an image, load a video, load 3 images from xml, load and unload a swf... etc. really simple module things. Then when people ask "how do i do X when the video is done playing?" I just dig open my VideoLoader file and pluck away.

 

With the LoaderMax series on Snorkl.tv I'm really hoping to give people like you a sound starting point for doing x, y and z. I've found that having something that works with basic functionality makes adding the bells and whistles seem like not so much of a leap. Its great to see people using those files.

 

I have a zillion things left to cover with LoaderMax. its a big mountain to climb but hope to get the next tutorial up sometime soon. I'm pretty much learning as I go too. Answering questions in this forum is still pretty difficult for me but its really helped me improve.

 

Bookmark the documentation. I'm in there like 10 times a day and am still learning new things!

 

Good luck with the thumbnails, check out Jack's sample slideshow : http://www.greensock.com/as/LoaderMax/slideshow.zip

It is a very sound model to follow. If you are new to OOP it might appear a bit intimidating. There are probably half a dozen ways to do it. Take it one step at a time;)

 

-c

Link to comment
Share on other sites

I'm not part of the development team (that would be disastrous)

Too funny Carl, though I see from snorkl you like to keep things light, good for you. Life in general can get heavy :x

I did grab Jack's gallery example, was kinda daunting but after my 1st class based tut today (Zync) I see the method & advantages of classes (break the monster into pieces & attack one at a time).

 

One thing about GS I don't like (as a newb) is that I miss understanding the core essentials of ECMA scripting while working in it. Therefor I have been working 2 or more things at once to absorb what I can. As a time saver it's awesome and as well I just (today) installed Flashdevelop which is a shortcut heaven ;)

 

Thanks for all you & Jack (e.g.: GS crew?) do and I'm looking forward to learning and producing more in the near future. Gotta go, smoking a 12lb brisket in the rain :lol:

 

Karl (riding the short bus licking the window :roll: )

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...