Hi All,
the first code (which I put into a frame) is somehow in conflict with my document class.
I get these error messages:
1046: Type was not found or was not a compile-time constant: URLRequest
1180: Call to a possible undefined method URLRequest.
1180: Call to a possibly undefined method navigateToURL
But when I only use that code and unlink the document class it works. So there must be somehow a conflict between the two, but I have no idea how to integrate this code into my document class -
I already tried it but the error messages keep coming, probably I didn't do it right.
Has anybody a tip/hint how to solve this?
Thanks.
Best,
Florian
code in frame:
Actionscript Code:
btn_contact.addEventListener(MouseEvent.CLICK, contactClickHandler);
function contactClickHandler(event:MouseEvent):void {
var url:URLRequest = new URLRequest("../Subpages/SubpageContact.html");
navigateToURL(url, "_top");
}
code in document class:
Actionscript Code:
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.events.Event;
import flash.utils.Timer;
import flash.media.Sound;
import flash.media.SoundChannel;
public class DocClass2 extends MovieClip{
private var _timer2:Timer = new Timer(30);
private var _shakingimg2:Shakingimg2;
var snd2:JonSound1= new JonSound1();
var sndChannel2:SoundChannel;
private var _timer7:Timer = new Timer(31);
private var _shakingimg7:Shakingimg7;
var snd7:MarcoSound1= new MarcoSound1();
var sndChannel7:SoundChannel;
public function DocClass2():void{
_shakingimg2 = new Shakingimg2();
_shakingimg2.x = 265;
_shakingimg2.y = 125;
addChild(_shakingimg2);
_shakingimg2.addEventListener(MouseEvent.ROLL_OVER, onMouseOver2);
_shakingimg2.addEventListener(MouseEvent.ROLL_OUT, onMouseOut2);
_timer2.addEventListener(TimerEvent.TIMER, timerEvent2);
_shakingimg7 = new Shakingimg7();
_shakingimg7.x = 769.3;
_shakingimg7.y = 105.3;
addChild(_shakingimg7);
_shakingimg7.addEventListener(MouseEvent.ROLL_OVER, onMouseOver7);
_shakingimg7.addEventListener(MouseEvent.ROLL_OUT, onMouseOut7);
_timer7.addEventListener(TimerEvent.TIMER, timerEvent7);
}
//handling Shakingimg2
private function onMouseOver2(event:MouseEvent):void{
if (_timer2.running){
_timer2.stop();
}
else{
_timer2.start();
}
sndChannel2 = snd2.play(0, 10, null);
}
private function timerEvent2(event:TimerEvent):void{
_shakingimg2.rotation = Math.floor(Math.random() * 30) - 15;
}
private function onMouseOut2 (event:MouseEvent):void{
_timer2.stop();
sndChannel2.stop();
}
//handling Shakingimg7
private function onMouseOver7(event:MouseEvent):void{
if (_timer7.running){
_timer7.stop();
}
else{
_timer7.start();
}
sndChannel7 = snd7.play(0, 10, null);
}
private function timerEvent7(event:TimerEvent):void{
_shakingimg7.rotation = Math.floor(Math.random() * 30) - 15;
}
private function onMouseOut7 (event:MouseEvent):void{
_timer7.stop()
sndChannel7.stop();
}
}
}