funktion funktioniert nicht: FlashBuilder AS3 [Flash 10]
| Beiträge: 6 Registriert: Jun 2011
| 23.10.2011, 12:30
Hallo Leute,
ich sitze mal wieder an meinem Rechner um ein Projekt für die FH zu machen. Und wieder einmal komm ich einfach nicht weiter.
Ich will das ein Button erst sichtbar ist wenn das Bild (BitmapImage:"myImage") die Größe von 200px aufweist. Ich habe 2 Verschiedene Varianten eingebaut, aber es funktioniert keine von beiden.
Sowohl "function handleClick" als auch "function handleClickVersion2".
Was mache ich nur falsch???
Bitte helft mir!!!! DANKE
_________________________________________________________________
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:local="*"
title="HomeView">
<fx:Declarations>
<fx:Component className="AlertMsg">
<s:SkinnablePopUpContainer x="70" y="300">
<s:TitleWindow title="Gewonnen" close="close()">
<s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
<s:Label text="Herzlichen Glückwunsch, du hast gewonnen"/>
<s:Button label="OK" click="close()"/>
</s:VGroup>
</s:TitleWindow>
</s:SkinnablePopUpContainer>
</fx:Component>
<mx:SoundEffect id="mySounds" source="assets/Cow (sound).mp3"
duration="4000"/>
<s:Animate id="myAnimation">
<s:motionPaths>
<s:MotionPath property="x">
<s:keyframes>
<s:Keyframe time="0" value="150"/>
<s:Keyframe time="1000" value="{myButton.x-myImage.width+300}"/>
</s:keyframes>
</s:MotionPath>
<s:MotionPath property="y">
<s:keyframes>
<s:Keyframe time="0" value="150"/>
<s:Keyframe time="1000" value="{myButton.y-myImage.height+300}"/>
</s:keyframes>
</s:MotionPath>
<s:MotionPath property="scaleX">
<s:keyframes>
<s:Keyframe time="0" value="0"/>
<s:Keyframe time="1000" value="2"/>
</s:keyframes>
</s:MotionPath>
<s:MotionPath property="scaleY">
<s:keyframes>
<s:Keyframe time="0" value="0"/>
<s:Keyframe time="1000" value="2"/>
</s:keyframes>
</s:MotionPath>
</s:motionPaths>
</s:Animate>
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import flash.events.TextEvent
import flash.utils.Timer;
import mx.events.FlexEvent;
import org.osmf.elements.ImageElement;
import spark.components.SkinnablePopUpContainer;
import spark.events.PopUpEvent;
import spark.events.ViewNavigatorEvent;
// import mx.controls.Alert;
private function handleClick(event:MouseEvent):void
{
//mx.controls.Alert.show('clicked!');
var adobeURL:URLRequest = new URLRequest("nächsteSeite");
if (myImage.width==200)
{
"Das funktioniert";
this.Gewonnen1.visible = true;
navigateToURL (new URLRequest ("http://fh-kiel.de/medien"));
}
else
{
"Das funktioniert nicht";
this.Gewonnen1.visible = true;
}
}
private function handleClickVersion2(event:MouseEvent):void
{
//mx.controls.Alert.show('clicked!');
var adobeURL:URLRequest = new URLRequest("nächsteSeite");
if (myImage.width==200)
{
"Das funktioniert";
this.Gewonnen.visible = true;
navigateToURL (new URLRequest ("http://fh-kiel.de/medien"));
}
else
{
"Das funktioniert nicht";
this.Gewonnen.visible = true;
}
}
]]>
</fx:Script>
<s:BitmapImage id="myImage" source="@Embed('assets/Icon.jpg')"
x="100" y="100" width="100" height="100"/>
<!--Image, dass die Animation auslößt-->
<s:Image id="myButton" x="100" y="100" width="100" height="100"
click="myAnimation.play([myImage])" enabled="true" smooth="false"
source="@Embed('assets/Icon.jpg')"
mouseDownEffect="{mySounds}" />
<s:Button id="Gewonnen" label="Show Alert" click="(new AlertMsg()).open(this, false)" visible="false"/>
<s:Button id="Gewonnen1" label="Show Alert" click="handleClick(event)" visible="false"/>
</s:View> | |
| Ähnliche Beiträge zum Thema | 15.04.2021 - hansi24 13.09.2021 - Willisquirion 08.05.2022 - Indy_Crossover 28.07.2022 - TateBauch |
|
Flashhilfe.de Flash Platform Tipps & Tutorials Flash Platform Andere Programmiersprachen Jobangebote Diskussionen
Flashhilfe News
Regeln & Bedingungen
|