I'm having some issues with getting a movieclip symbol to display correctly in the exe build version of the swf. The clip displays fine in the flash author environment. All this movieclip is is just a loading indicator that gets attached after the user clicks the "Open" button at the bottom. The clip is basically just a box that has a shape tween of 100 frames that have a red bar that fills the box from 1 - 100. Then once the user selects the "trf" file he wants to view, the file is read in as binary and each page is split to an element of an array, then the code loops to convert each page from hex to ASCII. The code also calculates the percentage of the current page compared to the total pages (nearest whole number) in order do the gotoAndStop of the loader clip at the frame that represents that percentage. Then when it's done converting all the pages, the loader clip is removed.
As I said, the clip works fine when you debug in flash. If you want to test it, there's a hardcoded hex string on line 32 that is used for debugging since the ssCore commands only work with the built exe. You just have to line comment the block comment tags on lines 31 and 34.
Also, if you comment out the portion of the code that removes the load clip (line112), you'll see that the load clip actually shows up in the built exe at the very end when everything is completed, and the red bar is filled 100%. So I figured the display wasn't getting updated, which is why I added updateAfterEvent(), but that apparently didn't help. Any help would be greatly appreciated.
for (var i = 0; i < my_array.length; i++)
var completed = ((i + 1) / my_array.length) * 100
var percdone:Number = int(completed);
You can't use loops for redrawing graphics, but you can use onEnterFrame ( loop based on the frames) or setInterval ( loop based on the timer).
Not sure I follow. When I step through the debug with the hardcoded string (which has 2 pages after being split), I can actually see the clip set correctly to frame 50 after the 1st page is done converting. But even if it was the redraw in a loop issue, why would the clip not be visible at all until the very end after everything is done converting? Wouldn't the clip be visible and stay on frame 1 like it is when it is originally loaded, and just not update with the gotoAndStop?
for(var i = 0; i < 100; i++)
clip._x = i; // <- break point here
When debugger comes to the break point, script execution will be halted and display updated.
In normal mode, display will be updated only after executing of the loop.
Hmm, so "updateAfterEvent()" wouldn't help with a loop? So you're suggesting instead of using a for loop with pages[i] for the conversion part, I use an onEnterFrames loop with my loadmc that when all pages are done converting, the loop is discontinued due to the removing of the movie clip?
Thank you sir, your suggestion worked perfectly. Thanks for taking the time to help me out.
You have to split the conversion into several stages and putting them on onEnterFrame event;
+ Just in case:
var data1 = "Hello_world_Hello_world_Hello_world";
var data2= "";
var position = 0;
var step_length = 5;
data2 += data1.substr(position, step_length);
position += step_length;
if(position >= data1.length) onEnterFrame = null;