Flash develop...

Thread Solved

Join Date: Jan 2009
Posts: 327
Reputation: JasonHippy is just really nice JasonHippy is just really nice JasonHippy is just really nice JasonHippy is just really nice 
Solved Threads: 59
JasonHippy's Avatar
JasonHippy JasonHippy is offline Offline
Posting Whiz

Tracing in Flashdevelop...

 
1
  #11
Oct 7th, 2009
Yup you got it Raja, that's how you set up the path to the SDK and the path to the external flash player!

I've got my Flashdevelop set up to use the flashplayer10 debug executable!
Note: in the FlashViewer section of the program settings, ensure that the 'Movie Display Style' property is set to External!
'Popup' and 'Document' use the default player (fp 9 debug ActiveX)

In order to demonstrate tracing in flashdevelop, I've knocked a little example project together. (see attached files.)

To actually create the project, I've just gone to 'project->new project' in the menu and then in the dialog I've selected the 'AS3 Project' template and called the project Tracing.

Flashdevelop has now created a few directories (bin, lib and src) and files. Briefly exploring the generated files and folders:
The bin folder is where the final .swf will end up being built.
Initially the bin folder contains a html file which is set up to embed the final .swf using swfobject.js (found in the js sub-folder). It also includes expressinstall.swf, which is also used by the html page, in case people viewing the page have an older version of flash...in which case, it can download and install the correct version.

The lib folder is where you can put any assets for your project (Bitmaps fonts etc.). It should be noted that simply adding items to the lib folder does not make them instantly accessible to the project. You first have to right-click them and then select 'Add to library'. Once you've added items to the library, you can drag them out of the library and drop them onto a blank line in your code and Flashdevelop will automatically generate code to embed the asset!

And finally the src folder is where your actionscript files will go.
Initially for the 'AS3 project' template there will be one file called main.as. Main.as is the main application class. So this is the class that holds everything together!

Main.as initially contains the Main class constructor and a function called init.
The constructor code is interesting...
if the 'stage' object has already been created and initialised, the init function is called.
Otherwise an event listener is set up to listen for the ADDED_TO_STAGE event. The listener will call the init function..

Never seen that code in the blank AS3 project before..This is new to me, I've only just upgraded my flashdevelop to the latest version, I was running the beta9 version of FD...hmm..Pretty nifty though!

So the init function is the entry point, this is where you initialise your application.

OK, so now we're ready to enter some code...
All I'm going to do here is write a bit of code to output some trace statements...But before that, I'm just gonna set the size of the final .swf!
In the menu, select 'project->properties' and change the dimensions of the .swf to 150X150 (we don't need anything too big seeing as we're not gonna be putting anything on the stage!)

OK that's that! Now we'll enter some code.
This is what I've put into main.as:
ACTIONSCRIPT Syntax (Toggle Plain Text)
  1. package
  2. {
  3. import flash.display.Sprite;
  4. import flash.events.Event;
  5.  
  6. /**
  7. * ...
  8. * @author Jason Trunks
  9. */
  10. public class Main extends Sprite
  11. {
  12.  
  13. public function Main():void
  14. {
  15. if (stage) init();
  16. else addEventListener(Event.ADDED_TO_STAGE, init);
  17. }
  18.  
  19. private function init(e:Event = null):void
  20. {
  21. // entry point
  22. removeEventListener(Event.ADDED_TO_STAGE, init);
  23. trace("Inside init function...");
  24. trace("Calling doSomething function..");
  25. doSomething();
  26. trace("Back inside init function...");
  27. }
  28.  
  29. private function doSomething():void
  30. {
  31. trace("Inside doSomething function..");
  32. for (var i:Number = 0; i < 10; ++i)
  33. {
  34. trace("value of i is: " + String(i));
  35. }
  36. }
  37.  
  38. }
  39.  
  40. }

All we've done there is add a few trace statements to the init function and added another function called doSomething, which just runs a quick for loop and traces the value of the loops index (variable 'i'!).

Next we ensure that the project is in debug mode by checking the dropdown box in the main toolbar (it should be by defalt!)....Looking at that....Yup, that's definitely in debug mode!
Next click on the blue triangular icon that looks like the play button on your VCR/Media player/Walkman/Mp3 player/iPod, this will build our .swf and open it in the external flash player.

Surely enough, flash player pops up and displays a blank white movieclip...Lovely jubbly!
"OK, so where are the Trace statements?" I hear you cry...Well, if you mouse over the 'output' tab in the bar at the bottom of the screen you should see some trace statements. {Ta daaaaa! heh heh!} (see also the attached .png!)

If you can't see the 'output' tab, select 'view->output panel' from the main menu and the output tab should appear.
If you need to keep the output panel open so you can see your traces at all times, you can pin it in place (rather like visual studio).

Additional notes on tracing...
As mentioned, tracing only works when you are in debug mode and only when your file is part of the currently active/open project.

Also, when you are done with debugging your masterpiece. don't forget to set the configuration to release and then rebuild your .swf.
This will omit your trace statements from the final .swf (they stay in your code, they just don't get compiled into the .swf), it also removes some other additonal bits 'n bobs that are used by FD for debugging..

I can't count the number of times that I've been on websites recently and got a popup from flash player asking where the local debugger instance is because some doughnut of a designer on a deadline forgot to rebuild their .swf in release mode before uploading it to a site...Grrr...This issue doesn't affect your average joe with their vanilla flash player, it only affects people who use the content debugger versions...Like me...Aaaaagh! heh heh!

There was one site that became virtually unusable to me a while ago because every single page had this one annoying flash advert at the top of the page that was a debug build...So every time I went to a different page I got that damn popup from flashplayer....That drove me nuts!

Installing the adblock pro plugin for firefox solved that problem for me! "Take that you clueless half-arsed advertising morons with your poor actionscript skills and annoying flash banners!" Ha!

Ooops, sorry! Went into a bit of an anti advertising rant there!

OK, so that's tracing in FD. It only works if you use it in an active/open project and only in debug mode!
And don't forget to rebuild in release mode once your done debugging! heh heh!

Cheers for now,
Jas.
Attached Thumbnails
Tracing.png  
Attached Files
File Type: zip TracingInFD.zip (9.2 KB, 1 views)
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 151
Reputation: rajarajan07 is on a distinguished road 
Solved Threads: 21
rajarajan07's Avatar
rajarajan07 rajarajan07 is offline Offline
Junior Poster
 
1
  #12
Oct 7th, 2009
Everything works except trace,
output panel shows:

Graphics and Multimedia Syntax (Toggle Plain Text)
  1. Starting new compile.
  2. Loading configuration file C:\Program Files\FlashDevelop\Flex_SDK\frameworks\flex-config.xml
  3. Loading configuration file C:\Documents and Settings\rajarajan\Desktop\ProjectTracing\obj\ProjectTracingConfig.xml
  4. obj\ProjectTracing633905373543906250 (999 bytes)
  5. (fcsh)
  6. Build succeeded
  7. Done (0)
  8. [Capturing traces with FDB]
Thanks & Regards,
RajaRajan. R

trulyraja2009@yahoo.in
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 327
Reputation: JasonHippy is just really nice JasonHippy is just really nice JasonHippy is just really nice JasonHippy is just really nice 
Solved Threads: 59
JasonHippy's Avatar
JasonHippy JasonHippy is offline Offline
Posting Whiz
 
0
  #13
Oct 7th, 2009
Originally Posted by rajarajan07 View Post
Everything works except trace,
output panel shows:

Graphics and Multimedia Syntax (Toggle Plain Text)
  1. Starting new compile.
  2. Loading configuration file C:\Program Files\FlashDevelop\Flex_SDK\frameworks\flex-config.xml
  3. Loading configuration file C:\Documents and Settings\rajarajan\Desktop\ProjectTracing\obj\ProjectTracingConfig.xml
  4. obj\ProjectTracing633905373543906250 (999 bytes)
  5. (fcsh)
  6. Build succeeded
  7. Done (0)
  8. [Capturing traces with FDB]

OK, well the only thing I can think of is perhaps you aren't using one of the debug flash players...Only the content debugger versions of flashplayer will allow you to see trace actions.
The standard player doesn't show them.

Try going to http://www.adobe.com/support/flashplayer/downloads.html and download and install the flash player 10 projector content debugger.

Once you've got it, set your copy of Flashdevelop up, so it uses the content debugger as the external player. Next, reload your project and try building/testing it!
You should now be able to see trace statements!

Cheers for now,
Jas.
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert
 
0
  #14
Oct 7th, 2009
Sweet jesus that was a lot of work but finally got it.

I was downloading the wrong exe it's the third one down

Download the Windows Flash Player 10 Projector content debugger (EXE, 5.18 MB).

Thanks a lot.


Notes
Project > properties > play in external player.
Then you have to set the output file of the swf.
Then on the tree menu in the right hand side, right click on the actionscript file and choose 'Always compile'.

Make sure it is set to debug and then finally click the blue triangle. Pressing ctrl+F8 doesn't show the trace.

Oh and you've got to create this as a project and not just a stand alone actionscript file.
Last edited by iamthwee; Oct 7th, 2009 at 3:48 pm.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 151
Reputation: rajarajan07 is on a distinguished road 
Solved Threads: 21
rajarajan07's Avatar
rajarajan07 rajarajan07 is offline Offline
Junior Poster
 
0
  #15
Oct 8th, 2009
Thanks a lot Iamthwee and Jason, now its working.
Thanks & Regards,
RajaRajan. R

trulyraja2009@yahoo.in
Reply With Quote Quick reply to this message  
Reply

Tags
flash, flash-develop, free, iamthwee

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Graphics and Multimedia Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC