http://soulseekrecords.org/psysci/animation/tarot.html
如果您转到该页面并单击卡片组。有些点击不起作用。大多数点击都有。在闪光灯下测试电影时也会出现此问题。
//import tweening files
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.MovieClip;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import fl.controls.UIScrollBar;
import flash.display.Sprite;
//create array of image names
var imageNames:Array = new Array();
var descText:Array = new Array();
//variable for total number of images
var totalImages:uint = imageNames.length;
//create a variable to load the large image
var bigImageLoader:Loader = new Loader;
//add bigImageLoader to the display list
//create random number
var randomNumber:uint;
//Scroll Variables
var scrollBarAdd:Boolean = false;
var scrollBar:UIScrollBar = new UIScrollBar();
addChild(bigImageLoader);
bigImageLoader.x = 130;
bigImageLoader.y = 25;
//create a textField
var myText:TextField = new TextField();
//add text box to display list
addChild(myText);
myText.width = 400;
myText.height = 180;
myText.x = 20;
myText.y = 200;
myText.wordWrap = true;
myText.multiline = true;
myText.selectable = true;
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.color = 0x000000;
format.size = 16;
format.underline = false;
myText.defaultTextFormat = format;
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("master.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event)
{
myXML = new XML (e.target.data);
for(var i:uint = 0; i < myXML.img.length() ; i++)
{
imageNames.push(myXML.img[i].text());
descText.push(myXML.txt[i].text()) ;
}
totalImages = imageNames.length;
}
//add button
var deckOfCards:Deck = new Deck();
//add button to display list
addChild(deckOfCards);
//Set button x and y position
deckOfCards.x = 20;
deckOfCards.y = 20;
//set buttonmode
deckOfCards.buttonMode = true;
//make sure all clicks register with the thumb itself (not inner contents)
deckOfCards.mouseChildren = false;
//add click listener to the button
deckOfCards.addEventListener(MouseEvent.MOUSE_DOWN, buttonClickHandler);
function buttonClickHandler (event:MouseEvent)
{
for ( var i:uint = 0; i < totalImages; i++ )
{
randomNumber = Math.round(Math.random()*totalImages);
if (randomNumber == i)
{
//load the corect image into the big image loader
bigImageLoader.load(new URLRequest("images/" + imageNames[randomNumber] ) );
bigImageLoader.scaleX = .0;
TweenLite.to( bigImageLoader, .5, {scaleX:1 , ease:Expo.easeOut} );
myText.alpha = 0;
TweenLite.to( myText, .5, {alpha:1} );
myText.text = String (descText[randomNumber]);
if (myText.textHeight > myText.height)
{
scrollBar.scrollTarget = myText; //assign the target of the scrollBar to your textfield
scrollBar.height = myText.height; //make the height the same as the textfield
scrollBar.move(myText.x + myText.width, myText.y); //Move the scrollbar to the righthand side
addChild(scrollBar);
scrollBar.update();
scrollBarAdd = true;
} else {
if((myText.textHeight < myText.height) && scrollBarAdd == true){
scrollBarAdd = false;
removeChild(scrollBar);
}
}
}
}
}
我的xml结构如下
<?xml version="1.0" encoding="UTF-8"?>
<master>
<img>joker.png</img>
<img>aceOfClubs.png</img>
<img>twoOfClubs.png</img>
...
<txt>The average stage of man...</txt>
<txt>This is an Ace of Clubs.</txt>
<txt>This is a two of Clubs.</txt>
...
</master>
答案 0 :(得分:0)
您可能已经这样做了,但为了辨别实际事件或您的代码是否会产生此问题,请在执行循环之前在buttonClickHandler中添加跟踪。
我很感兴趣,如果你点击那个牌组时事件真的被解雇了......