Dmitrich256
09.01.2013, 18:55
Доброго времени суток!
Пишу уровень для игры (лабиринт), в котором нужно дойти до замка.
Возникла проблема при переходе на другой кадр, вот что пишет:
ArgumentError: Error #2005: Неправильный тип параметра 0. Должен быть тип IBitmapDrawable.
at flash.display::BitmapData/draw()
at Game2_fla::MainTimeLine/onEnterFramef2()
Думаю, нужно как-то эту битдату заремувить, но как? подскажите пожалуйста
Вот код:
stop()
Mouse.show()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//музыка
backSoundPystChannel = backSoundPyst.play();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//кнопки
playagain3.addEventListener(MouseEvent.CLICK, restart3M)
addTimeMouseS2.addEventListener(MouseEvent.CLICK, addTimeMouseS2222)
function restart3M(e:MouseEvent):void
{
stage.removeEventListener(Event.ENTER_FRAME, onEnterFramef2)
TimerMouseS2Instance.stop()
//removeChild(MouseStage2)
removeChild(Sheva1);
backSoundPystChannel.stop()
gotoAndStop("M_end2");
}
function addTimeMouseS2222(e:MouseEvent):void
{
TimerMouseS2 += 10
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//таймер обратного отсчета
var TimerMouseS2:Number = 50;
var mouseMinutesStage2 = 0
var mouseSecondsStage2 = 0
var TimerMouseS2Instance:Timer = new Timer(1000, TimerMouseS2);
TimerMouseS2Instance.addEventListener(TimerEvent.TIMER,TimerMouseS2Handler);
TimerMouseS2Instance.start();
function TimerMouseS2Handler(event:TimerEvent):void
{
mouseMinutesStage2 = Math.floor(TimerMouseS2/60)
mouseSecondsStage2 = TimerMouseS2 - mouseMinutesStage2*60
if (TimerMouseS2 >=60)
{
timer2_txt.text = mouseMinutesStage2 + " хв " + mouseSecondsStage2 + " с"
} else {
timer2_txt.text = mouseSecondsStage2 + " секунд"
}
TimerMouseS2--;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//подцепление мышкой
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMovef2);
Sheva1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverf2);
var begin2:Boolean = false;
function mouseMovef2(e:MouseEvent):void
{
if(begin2)
{
Sheva1.x = mouseX;
Sheva1.y = mouseY;
e.updateAfterEvent()
}
}
function mouseOverf2(e:MouseEvent):void
{
begin2 = true;
Mouse.hide();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//проверка цвета пикселя и переход
addEventListener(Event.ENTER_FRAME, onEnterFramef2);
function onEnterFramef2(e:Event):void
{
var MouseStage2BD:BitmapData = new BitmapData(1024, 768);
MouseStage2BD.draw(MouseStage2);
var takenPixel:String = MouseStage2BD.getPixel(Sheva1.x, Sheva1.y).toString(16);
if(takenPixel == "0")
{
begin2 = false;
Sheva1.x = 45;
Sheva1.y = 45;
Mouse.show();
//backSoundLoseChannel = backSoundLose.play()
}
if(takenPixel == "ff0000")
{
stage.removeEventListener(Event.ENTER_FRAME, onEnterFramef2)
TimerMouseS2Instance.stop()
removeChild(Sheva1);
backSoundPystChannel.stop()
gotoAndStop("M_win2");
}
if(takenPixel == "ffff00")
{
TimerMouseS2 += 10
//backSoundTimeChannel = backSoundTime.play()
}
if (TimerMouseS2 == 0) {
stage.removeEventListener(Event.ENTER_FRAME, onEnterFramef2)
TimerMouseS2Instance.stop()
removeChild(Sheva1);
backSoundPystChannel.stop()
gotoAndStop("M_end2");
}
if(TimerMouseS2 > 240)
{
TimerMouseS2 = 40
begin2 = false;
Sheva1.x = 45;
Sheva1.y = 45;
Mouse.show();
backSoundTeleportChannel = backSoundTeleport.play()
}
}
Пишу уровень для игры (лабиринт), в котором нужно дойти до замка.
Возникла проблема при переходе на другой кадр, вот что пишет:
ArgumentError: Error #2005: Неправильный тип параметра 0. Должен быть тип IBitmapDrawable.
at flash.display::BitmapData/draw()
at Game2_fla::MainTimeLine/onEnterFramef2()
Думаю, нужно как-то эту битдату заремувить, но как? подскажите пожалуйста
Вот код:
stop()
Mouse.show()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//музыка
backSoundPystChannel = backSoundPyst.play();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//кнопки
playagain3.addEventListener(MouseEvent.CLICK, restart3M)
addTimeMouseS2.addEventListener(MouseEvent.CLICK, addTimeMouseS2222)
function restart3M(e:MouseEvent):void
{
stage.removeEventListener(Event.ENTER_FRAME, onEnterFramef2)
TimerMouseS2Instance.stop()
//removeChild(MouseStage2)
removeChild(Sheva1);
backSoundPystChannel.stop()
gotoAndStop("M_end2");
}
function addTimeMouseS2222(e:MouseEvent):void
{
TimerMouseS2 += 10
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//таймер обратного отсчета
var TimerMouseS2:Number = 50;
var mouseMinutesStage2 = 0
var mouseSecondsStage2 = 0
var TimerMouseS2Instance:Timer = new Timer(1000, TimerMouseS2);
TimerMouseS2Instance.addEventListener(TimerEvent.TIMER,TimerMouseS2Handler);
TimerMouseS2Instance.start();
function TimerMouseS2Handler(event:TimerEvent):void
{
mouseMinutesStage2 = Math.floor(TimerMouseS2/60)
mouseSecondsStage2 = TimerMouseS2 - mouseMinutesStage2*60
if (TimerMouseS2 >=60)
{
timer2_txt.text = mouseMinutesStage2 + " хв " + mouseSecondsStage2 + " с"
} else {
timer2_txt.text = mouseSecondsStage2 + " секунд"
}
TimerMouseS2--;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//подцепление мышкой
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMovef2);
Sheva1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverf2);
var begin2:Boolean = false;
function mouseMovef2(e:MouseEvent):void
{
if(begin2)
{
Sheva1.x = mouseX;
Sheva1.y = mouseY;
e.updateAfterEvent()
}
}
function mouseOverf2(e:MouseEvent):void
{
begin2 = true;
Mouse.hide();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//проверка цвета пикселя и переход
addEventListener(Event.ENTER_FRAME, onEnterFramef2);
function onEnterFramef2(e:Event):void
{
var MouseStage2BD:BitmapData = new BitmapData(1024, 768);
MouseStage2BD.draw(MouseStage2);
var takenPixel:String = MouseStage2BD.getPixel(Sheva1.x, Sheva1.y).toString(16);
if(takenPixel == "0")
{
begin2 = false;
Sheva1.x = 45;
Sheva1.y = 45;
Mouse.show();
//backSoundLoseChannel = backSoundLose.play()
}
if(takenPixel == "ff0000")
{
stage.removeEventListener(Event.ENTER_FRAME, onEnterFramef2)
TimerMouseS2Instance.stop()
removeChild(Sheva1);
backSoundPystChannel.stop()
gotoAndStop("M_win2");
}
if(takenPixel == "ffff00")
{
TimerMouseS2 += 10
//backSoundTimeChannel = backSoundTime.play()
}
if (TimerMouseS2 == 0) {
stage.removeEventListener(Event.ENTER_FRAME, onEnterFramef2)
TimerMouseS2Instance.stop()
removeChild(Sheva1);
backSoundPystChannel.stop()
gotoAndStop("M_end2");
}
if(TimerMouseS2 > 240)
{
TimerMouseS2 = 40
begin2 = false;
Sheva1.x = 45;
Sheva1.y = 45;
Mouse.show();
backSoundTeleportChannel = backSoundTeleport.play()
}
}