1180 error:Call to a possibly undefined method addFrameScript in as3
package {
import flash.display.Sprite;
import flash.utils.*;
public class SetTimeoutExample extends Sprite {
private var delay:Number = 1000; // delay before calling myDelayedFunction
public function SetTimeoutExample() {
var intervalId:uint = setTimeout(myDelayedFunction, delay,stopTime);
}
public function myDelayedFunction():void {
if(arguments[0] ==fk.playheadTime)
{fk.pause();}
}
}
}//this is my document class named SetTimeoutExample.as
import flash.net.URLLoader;
import fl.video.*;
import flash.utils.getTimer;
import flash.events.Event;
fk.autoPlay = false;
var myLoaderInfo=new Object();
myLoaderInfo.myParamsLoaded = false;
myLoaderInfo.loaderComplete = loaderComplete;
this.loaderInfo.addEventListener(Event.COMPLETE, myLoaderInfo.loaderComplete);
myLoaderInfo.useParams = useParams;
var myParams:Object = new Object();
var myParamsLoaded:Object = new Object();
function loaderComplete(myEvent:Event)
{
this.myParams = this.loaderInfo.parameters;
this.myParamsLoaded = true;//Parametrelerin yuklendigine emin olduk.
this.useParams();
fk.play(src);
}
var src:String;
var startTime:Number;
var stopTime:Number;
function useParams()
{
var obj:Object = new Object();
var j;
for (j in this.myParams)
{
if (j == "url")
{
src = this.myParams[j];
}
else if (j=="bas")
{
startTime = int(this.myParams[j]);
}
else
{
stopTime = int(this.myParams[j]);
}
}
}
fk.addEventListener(VideoEvent.READY, bitti);
function bitti(eventObject:VideoEvent):void
{
fk.seekSeconds(startTime);
} //this is my player.fla
hi,i get this 1180 error in as3.ho开发者_如何学编程w can i solve this?i google it but i can't apply the solutions to my my code.i'm really new to as3.thanks for any help.
Let me get this straight: you have set a Document Class
in fla properties and are writing code directly in fla as well?
If this is the case, solution is simple: either write your code only in external .as files and not fla or do not use Document Class
if you wish continue writing code on the Timeline
.
The error code you get states that you have code on your Timeline
which behaves like a MovieClip
, while your Document Class
extends Sprite
and therefore is not aware of method called addFrameScript
(this method is called while compiling code that is on the Timeline
into SWF file).
In short, I'd adviced you to change
public class SetTimeoutExample extends Sprite {
to
public class SetTimeoutExample extends MovieClip {
and move all your fla code to Document Class
.
Do you have any timeline code? AddFrameScript() is the method that gets called to allow timeline code to execute. I've seen that error myself.
Just make sure you don't have any code on the timeline in any of your assets and that should go away.
I solved the problem and now I'm successfully using an external AS class while implementing some other function on the TimeLine:
The problem can be solved just following this simple "rule":
if you want to JUST load everything from the external CLASS, you have to "link" the .fla file to the .as ("Document Class"):
the timeline use the addFrameScript function
if you want to USE something from the class, while doing something else on the timeline, you JUST HAVE TO PUT a similar line on the TimeLine:
var myClassObject:myClass = new myClass(); this.addChild(myClassObject);
I just had this issue as well. The problem was that my container movie clip was extending Sprite and inside, one of the controls was converted to flash component with properties... I have a feeling Flash was trying to set value of those properties on the timeline. Removing component from the stage and adding it from the library fixed the issue for me after 30 minutes of pulling my hair out....
Got
TypeError: Error #1034: Type Coercion failed: cannot convert the_game@2a9c50b1 to flash.display.MovieClip. at Game::Player/update() at the_game_itself/update()
with Bit slow...
If the error in the question (title) happens to you when adding code to a movieclip (not on the timeline), try this:
It might be that the library item (movieclip) has had it's actionscript properties set to inherit from Sprite (baseclass)... Some kind of coding bug... Check that movieclips actionscript properties (in the library, rightclick (on the movieclip)/properties).
精彩评论