|
-
Upgrade to Flash 8
I recently upgraded my version of Koolmoves to add support for flash 8, and was previously using only flash 6. I want to compile my movie using flash 8 to take advantage of new features, but I seem to have a problem with my actionscript code. I must be using some discontinued code in my movie. I'm assuming I'm probably making some stupid mistake, but can someone point me out here?
BTW, this code is inside a movieclip. The code itself should work, because it works fine in flash6, just I need to know what standard i must be breaking.
Code:
loading = this._parent.getBytesLoaded();
total = this._parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = math.round(percent);
pos = (per-100)*1.16;
Pro._x = pos;
Pro._width = (per*2.32);
if (percent>99) {
this._parent.gotoAndPlay("Intro");
}
Also I've been having a problem where I am trying to call a function from a different frame in my main timeline. Can someone tell me how this is done?
Thank you ahead of time.
-Gandalf2349
Last edited by Gandalf2349; 05-02-2006 at 04:24 PM.
-
For one thing, math should be Math. Flash 8 is case sensitive.
-
Well, that helps, but I still have the same problem.
I believe the problem is in the way I am accessing the parent object. I've tried using _root as well instead of this._parent, but neither worked.
I believe this is the problem because I am not getting load data from the parent, and it is not playing movie after it's loaded. If it was a problem with my bar it wouldn't move but would play the movie after it loaded.
-
KoolMoves Moderator
Might not matter but I don't think you need this with the _parent or _root so try just _parent.gotoAndPlay
-
I've tried that already as well.
That's what I had origionally when it stopped working for flash 8, but I added the "this" because I figured that it was possible flash8 became more object oriented and required that.
-
Using flash 6, after a line like x -= x - 4 is executed for the first time the variable x will be will be 4, when using flash 8 it will be NaN (not a number).
Set percent to 0 somewhere else before this routine is called or include a line like code: if (typeof(percent) != 'Number') percent = 0;
before the line that calculates percent.
-
up to my .as in code
Wilbert rocks.
Since we don't have a trace window in koolmoves, you can track down these kind of syntax errors between Flash 6 and Flash8 using dynamic textfields to trace with. That will usually disclose which line is generating an error.
loading = this.getBytesLoaded();
total = this.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
Since the variable "percent" is calculated using the "loading" and "total" variable, you could make three dynamic textfields with variables names of "percent", "total" and "loading" onstage to trace what is going on. The percent calculation is forgiven testing in Flash6 and all textfields will display but tested exporting as flash8 would show you the NaN in the percent field since it was not defined before being used in it's own variable calculation. That would help you narrow down the culprit when encountering version differences.
Try it and see what I mean. Tracing is very helpful.
Good call Wilbert.
-
KoolMoves Moderator
I often use a text field as a trace myself.
-
Well, that helps, but still is not fixing the problem. That had irked me for a while though, I was bugged that it was referencing itself without ever being set to anything, but it worked in flash6 so I assumed it would continue to work.
However my "tracing" returned some interesting results. It turns out that the code in my movieclip frames aren't even being run. I could trace to the textboxes from the main timeline, but any code inside of the movieclip did not fire. This is an updated version of my code.
Code:
if (typeof(percent) != 'Number') percent = 0;
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
_Parent.txt11.text="foo";
_Parent.txt11.text=loading;
_Parent.txt12.text=total;
_Parent.txt13.text=percent;
per = math.round(percent);
pos = (per-100)*1.16;
per = per;
Pro._x = pos;
Pro._width = (per*2.32);
if (percent>99) {
_parent.gotoAndPlay("Intro");
}
First off, yes it's supposed to be txt11, 1-10 have been declared already.
Even the "foo" is not being written, so the movieclip is not running. I tried adding an mc1.gotoAndPlay(1); in my main timeline but it's still not working.
Again, when I compile this using flash 6 it still works fine.
-
up to my .as in code
Give this a run Gandalf.
Flash8 ready.
http://sandbox.blogdns.com/Gandalf.swf
-
Alright, I think what I've narrowed the code down to is that the actionscript code for the frames of the movieclips aren't running. I have my loadingcode inside of a movieclip which should loop, but it never runs the code for it's frames.
Also, is it necessary to use that many different preliminary functions to achieve code that runs on the frame?
-
up to my .as in code
Well, you want it to loop around frame 1 and delete the onEnterFrame event to progress, hence all the functions. You could...for example...have a movieclip placed in frame 1 that is a solid bar that has it's _width value decided by the preload function. All kinds of things can be done during the preload. I just want you to have working variables to at least find a good starting point.
Personally...the days of me dealing with progress loader routines are long gone. With Bob's preloaders incorporated, everything I need is internal but I understand people still like to code them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|