How to stop program from looping in Animate CC 2015 - actionscript-3

Animate CC workframeHow do i stop this program from looping? The stop(); function won't work. It is not an animation clip but a drag and drop game. Because I'm still new to AS3, I would appreciate it if someone answered my question with explanations. Thanks!
item1.objName = "circle";
item1.initX = item1.x;
item1.initY = item1.y;
item1.val = 0;
item2.objName = "rectangle";
item2.initX = item2.x;
item2.initY = item2.y;
item2.val = 0;
item3.objName = "triangle";
item3.initX = item3.x;
item3.initY = item3.y;
item3.val = 0;
bin1.shape.alpha = 0;
bin2.shape.alpha = 0;
bin3.shape.alpha = 0;
item1.buttonMode = true;
item2.buttonMode = true;
item3.buttonMode = true;
item1.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
item1.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
item2.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
item2.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
item3.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
item3.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
//Mouse Events
function mousePress(event:MouseEvent):void {
var item:MovieClip = MovieClip(event.target);
item.startDrag();
item.scaleX = item.scaleY = .95;
var topPos:uint = this.numChildren - 1;
this.setChildIndex(item, topPos);
ilabel.itemName_txt.text = item.objName;
}
function mouseRelease(event:MouseEvent):void {
var item:MovieClip = MovieClip(event.target);
item.stopDrag();
switch (item.objName) {
case "circle" :
if (bin1.hitTestObject(item)){
updateShape(item, bin1);
}
else{
ilabel.info_txt.text ="WRONG! Hint: circle";
item.scaleX = item.scaleY = 1
}
break;
case "rectangle" :
if (bin2.hitTestObject(item)) {
updateShape(item, bin2);
}
else{
ilabel.info_txt.text ="WRONG! Hint: rectangle";
item.scaleX = item.scaleY = 1
}
break;
case "triangle" :
if (bin3.hitTestObject(item)){
updateShape(item, bin3);
}
else{
ilabel.info_txt.text ="WRONG! Hint: Triangle";
item.scaleX = item.scaleY = 1
}
break;
default :;
}
}
function updateShape(item:MovieClip, bin:MovieClip):void {
ilabel.itemName_txt.text = "";
item.scaleX = item.scaleY = 1;
item.visible = false;
ilabel.info_txt.text ="CORRECT! ";
bin.shape.alpha = 1;
item.val = 1;
resetShapes();
}
function resetShapes(){
if((item1.val == 1)&& (item2.val == 1) && (item3.val == 1)){
item1.x = item1.initX;
item1.y = item1.initY;
item2.x = item2.initX;
item2.y = item2.initY;
item3.x = item3.initX;
item3.y = item3.initY;
bin1.shape.alpha = 0;
bin2.shape.alpha = 0;
bin3.shape.alpha = 0;
item1.visible = true;
item2.visible = true;
item3.visible = true;
item1.val = 0;
item2.val = 0;
item3.val = 0;
}
}
function checkGame():void {
if ((item1.scaleX = item1.scaleY = 1)&& (item2.scaleX = item2.scaleY = 1)&&(item3.scaleX = item3.scaleY = 1))
{
ilabel.info_txt.text=" Well done!";
}
}

function checkGame():void {
if ((item1.scaleX = item1.scaleY = 1)&& (item2.scaleX = item2.scaleY = 1)&&(item3.scaleX = item3.scaleY = 1))
{
ilabel.info_txt.text=" Well done!";
item1.removeEventListener(MouseEvent.MOUSE_DOWN, mousePress);
item1.removeEventListener(MouseEvent.MOUSE_UP, mouseRelease);
item2.removeEventListener(MouseEvent.MOUSE_DOWN, mousePress);
item2.removeEventListener(MouseEvent.MOUSE_UP, mouseRelease);
item3.removeEventListener(MouseEvent.MOUSE_DOWN, mousePress);
item3.removeEventListener(MouseEvent.MOUSE_UP, mouseRelease);
}
This will stop the user from being able to select anything.
If you have a movie clip looping on 'item1' for example.
You need to add item1.stop(); also to the checkGame function...
Good luck!

Related

Character keeps falling when it shouldn't be

I am doing an assessment task for school in as3 and I have made a feature that will let the character fall if it is not standing on top of something but the boolean variable falling keeps being on when it is not supposed to. I have figured out that what causes it to stop for a short time and then fall again past what it is standing on is that the velocity valuable increases past the floor it is on so I reset the velocity value in the code in another spot but that does not solve the issue of the falling boolean being true when it is not supposed too.
I have put a comment at the temporary solution it is in the gameEngine function in the if(falling) statement
// Imports
import flash.events.KeyboardEvent;
import flash.events.Event;
// Constants that can be edited
const grav:Number = 0.05;
const jumpPow:Number = 15;
const walkingDistance = 50;
// Variables
var jumpVel:Number = jumpPow;
var velocity:Number = 0;
var dt:Number = 0;
var movingCount:Number = 0;
var newX:Number = 0;
var newY:Number = 0;
var charCornerHit:Number = 0; // 0 = TL 1 = TR 2 = BR 3 = BL (clockwise)
var jumping:Boolean = false;
var falling:Boolean = false;
var movingRight:Boolean = false;
var movingLeft:Boolean = false;
var hitDetVal:Boolean = false; // false
var floorHit:Boolean = false;
var object1Hit:Boolean = false;
var cCnrTL:Array = new Array(char.x, char.y);
var cCnrTR:Array = new Array(char.x + char.width, char.y);
var cCnrBR:Array = new Array(char.x + char.width, char.y + char.height);
var cCnrBL:Array = new Array(char.x, char.y + char.height);
var charCorners:Array = new Array(cCnrTL, cCnrTR, cCnrBR, cCnrBL); // Clockwise
addEventListener(Event.ENTER_FRAME, gameEngine);
function gameEngine(evt:Event):void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, moveCharacter);
charCorners[0][0] = char.x;
charCorners[0][1] = char.y;
charCorners[1][0] = char.x + char.width;
charCorners[1][1] = char.y;
charCorners[2][0] = char.x + char.width;
charCorners[2][1] = char.y + char.height;
charCorners[3][0] = char.x;
charCorners[3][1] = char.y + char.height;
//trace(char.y);
// Check if char is standing on something
// Supposed to only check when character is not falling
if (falling == false) {
//trace(char.y + char.height + 1)
hitDetection(0, char.y + char.height + 1)
if (hitDetVal == false) {
falling = true;
hitDetVal = false;
trace("not standing");
}
else {trace("standing on something");}
}
// Move char loop
if (movingRight){
if (movingCount == walkingDistance) {
movingCount = 0
movingRight = false;
} else {
char.x+=1
movingCount += 1;
}
} else if (movingLeft) {
if (movingCount == walkingDistance) {
movingCount = 0
movingLeft = false;
} else {
char.x-=1
movingCount += 1;
}
}
//trace(velocity)
if (falling) {
dt += 1
velocity = velocity + grav*dt
hitDetection(0, velocity)
if (hitDetVal) {
falling = false;
hitDetVal = false;
// TEMPORARY SOLUTION - Stopped character from falling past the floor but still ran falling condition
//velocity = 0;
//dt = 0;
if (floorHit) {
if (char.y < floor.y){
char.y = floor.y - char.height;
floorHit = false;
trace("Char Stopped falling")
}
} else if (object1Hit) {
if (char.y - char.height < object1.y){
char.y = object1.y - char.height;
object1Hit = false;
trace("Char Stopped falling")
}
}
} else {
char.y += velocity;
}
} else {
if (jumping) {
}
velocity = 0;
dt = 0;
}
}
function moveCharacter(event:KeyboardEvent):void{
if(event.keyCode == Keyboard.LEFT){
if(movingRight){
movingRight = false;
trace("STOPPED")
} else {
movingCount = 0
movingLeft = true;
trace("LEFT");
}
}
if(event.keyCode == Keyboard.RIGHT){
if(movingLeft){
movingLeft = false;
trace("STOPPED")
} else {
movingCount = 0
movingRight = true;
trace("RIGHT");
}
}
if(event.keyCode == Keyboard.UP){
jumping = true;
trace("UP");
}
}
function hitDetection(distX:Number, distY:Number) {
for (var i:uint = 0; i < charCorners.length; i++) {
newX = charCorners[i][0] + distX;
newY = charCorners[i][1] + distY;
if (floor.hitTestPoint(newX, newY, true)){
hitDetVal = true;
floorHit = true;
charCornerHit = i;
break;
} else if (object1.hitTestPoint(newX, newY, true)){
hitDetVal = true;
object1Hit = true;
charCornerHit = i;
break;
}
}
}```
It was a simple logic error occurring here
hitDetection(0, char.y + char.height + 1)
I had made adjustments for the location by adding char.y to the value when my hitDetection function already made an adjustment to each corner of my character. Only took ~3 hours to figure out

Actionscript 3 - Drag and Drop game with feedback, only one object working

I'm a newbie to Actionscript, so I'm not sure quite what the problem is with my code.
I'm creating a Flash/Actionscript game, where kids will drag and drop different food items onto the food pyramid - the modern one. All items drag and drop, however only the first item (banana_mc) creates feedback. I have no idea why this is happening, and there are no Compiler errors.
My actionscript is as follows:
banana_mc.objName = "banana";
banana_mc.initX = banana_mc.x;
banana_mc.initY = banana_mc.y;
banana_mc.val = 0;
bread_mc.objName = "bread";
bread_mc.initX = bread_mc.x;
bread_mc.initY = bread_mc.y;
bread_mc.val = 0;
broccoli_mc.objName = "broccoli";
broccoli_mc.initX = broccoli_mc.x;
broccoli_mc.initY = broccoli_mc.y;
broccoli_mc.val = 0;
burger_mc.objName = "burger";
burger_mc.initX = burger_mc.x;
burger_mc.initY = burger_mc.y;
burger_mc.val = 0;
carrot_mc.objName = "carrot";
carrot_mc.initX = carrot_mc.x;
carrot_mc.initY = carrot_mc.y;
carrot_mc.val = 0;
cheese_mc.objName = "cheese";
cheese_mc.initX = cheese_mc.x;
cheese_mc.initY = cheese_mc.y;
cheese_mc.val = 0;
chips_mc.objName = "chips";
chips_mc.initX = chips_mc.x;
chips_mc.initY = chips_mc.y;
chips_mc.val = 0;
corn_mc.objName = "corn";
corn_mc.initX = corn_mc.x;
corn_mc.initY = corn_mc.y;
corn_mc.val = 0;
eggplant_mc.objName = "eggplant";
eggplant_mc.initX = eggplant_mc.x;
eggplant_mc.initY = eggplant_mc.y;
eggplant_mc.val = 0;
egg_mc.objName = "egg";
egg_mc.initX = egg_mc.x;
egg_mc.initY = egg_mc.y;
egg_mc.val = 0;
banana_mc.buttonMode = true;
bread_mc.buttonMode = true;
broccoli_mc.buttonMode = true;
burger_mc.buttonMode = true;
carrot_mc.buttonMode = true;
cheese_mc.buttonMode = true;
chips_mc.buttonMode = true;
corn_mc.buttonMode = true;
eggplant_mc.buttonMode = true;
egg_mc.buttonMode = true;
banana_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
banana_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
bread_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
bread_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
broccoli_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
broccoli_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
burger_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
burger_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
carrot_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
carrot_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
cheese_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
cheese_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
chips_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
chips_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
corn_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
corn_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
eggplant_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
eggplant_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
egg_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
egg_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
//Mouse Events
function mousePress(event:MouseEvent):void {
var item:MovieClip = MovieClip(event.target);
item.startDrag();
var topPos:uint = this.numChildren - 1;
this.setChildIndex(item, topPos);
}
function mouseRelease(event:MouseEvent):void {
var item:MovieClip = MovieClip(event.target);
item.stopDrag();
switch (item.objName) {
case "banana" :
if (bottom_mc.hitTestObject(item)) {
updateShape(item, bottom_mc);
} else {
info_txt.text ="WRONG!";
}
break;
case "bread" :
if (third_mc.hitTestObject(item)) {
updateShape(item, third_mc);
} else {
info_txt.text ="WRONG!";
}
break;
case "broccoli" :
if (bottom_mc.hitTestObject(item)) {
updateShape(item, bottom_mc);
} else {
info_txt.text ="WRONG!";
}
break;
case "burger" :
if (top_mc.hitTestObject(item)) {
updateShape(item, top_mc);
} else {
info_txt.text ="WRONG!";
}
case "carrot" :
if (bottom_mc.hitTestObject(item)) {
updateShape(item, bottom_mc);
} else {
info_txt.text ="WRONG!";
}
case "cheese" :
if (second_mc.hitTestObject(item)) {
updateShape(item, second_mc);
} else {
info_txt.text ="WRONG!";
}
case "chips" :
if (top_mc.hitTestObject(item)) {
updateShape(item, top_mc);
} else {
info_txt.text ="WRONG!";
}
case "corn" :
if (bottom_mc.hitTestObject(item)) {
updateShape(item, bottom_mc);
} else {
info_txt.text ="WRONG!";
}
default :
; ;
}
function updateShape(item:MovieClip, bin:MovieClip):void {
item.visible = true;
info_txt.text ="CORRECT!";
item.val = 1;
resetShapes();
}
function resetShapes() {
if ((banana_mc.val == 1)&& (bread_mc.val == 1) && (broccoli_mc.val == 1) &&(burger_mc.val == 1) &&(carrot_mc.val == 1) &&(cheese_mc.val == 1) &&(chips_mc.val == 1) &&(corn_mc.val == 1) &&(eggplant_mc.val == 1) &&(egg_mc.val == 1)){
banana_mc.x = banana_mc.initX;
banana_mc.y = banana_mc.initY;
bread_mc.x = bread_mc.initX;
bread_mc.y = bread_mc.initY;
broccoli_mc.x = broccoli_mc.initX;
broccoli_mc.y = broccoli_mc.initY;
burger_mc.x = burger_mc.initX;
burger_mc.y = burger_mc.initY;
carrot_mc.x = carrot_mc.initX;
carrot_mc.y = carrot_mc.initY;
cheese_mc.x = cheese_mc.initX;
cheese_mc.y = cheese_mc.initY;
chips_mc.x = chips_mc.initX;
chips_mc.y = chips_mc.initY;
corn_mc.x = corn_mc.initX;
corn_mc.y = corn_mc.initY;
eggplant_mc.x = eggplant_mc.initX;
eggplant_mc.y = eggplant_mc.initY;
egg_mc.x = egg_mc.initX;
egg_mc.y = egg_mc.initY;
banana_mc.visible= true;
bread_mc.visible= true;
broccoli_mc.visible= true;
burger_mc.visible= true;
carrot_mc.visible= true;
cheese_mc.visible= true;
chips_mc.visible= true;
corn_mc.visible= true;
eggplant_mc.visible= true;
egg_mc.visible= true;
banana_mc.val= 0;
bread_mc.val= 0;
broccoli_mc.val= 0;
burger_mc.val= 0;
carrot_mc.val= 0;
cheese_mc.val= 0;
chips_mc.val= 0;
corn_mc.val= 0;
eggplant_mc.val= 0;
egg_mc.val= 0;
}
}
}
If anyone can please help me out, I'd really appreciate it! It's part of an assignment this week (not a coding one) so I'd really need a quick solution if possible...
Your switch statements are configured to look for the exact string specified by your object's name. So casing matters :)
Either do a item.objName.toLocalLowercase(), change your object's name to only include lowercase letters, or change your case's to match all your object's names by capitalizing everything except banana.
Just a useful tip to reduce code amount...
In your function updateShape(item:MovieClip, bin:MovieClip):void at the bottom you have:
resetShapes(); which might be better as resetShapes( item );
If you provide a function parameter (aka function argument) like above then when you run resetShapes it only has to deal with current clicked item (provided as function parameter) so you can just simply write...
function resetShapes ( in_item : MovieClip ) : void
{
if( in_item.val == 1)
{
in_item.x = in_item.initX;
in_item.visible = true;
in_item.val = 0;
}
}
Also in your function mouseRelease(event:MouseEvent):void at the bottom you have default : ; ; this might cause problems when you try to compile so fix or remove it. What are you trying to achieve with this command? If we understand your code or logic, it's easier to give you advice.
check this Switch/Case tutorial article for clarity...

AS3 - Restart Loop Error

I have now figured out that After I restart my game The Enter_frame function is not looping? why is that.
Enter_Frame:
public function enter_frame(e:Event)
{
trace("rGame = " + rGame);
_Menu();
if(mGameStart)
{
//Stage & Players
_PlayerStart();
_PlayerCon();
_MoveStage();
}
if(rGame)
{
_PlayerCon();
trace("_PlayerCon(): Done");
_MoveStage();
}
if(Game_Over)
{
mGameStart = false;
GameOver();
}
}
Pipe_Spawn:
private function eSpawn()
{
for(var i:int = 0; i < ePipeMax; i++)
{
var _Pipe:EPipe = new EPipe;
_Pipe.x = (i * 250) + 640;
_Pipe.y = Math.random() * 90;
PipeLayer.addChild(_Pipe);
}
}
Pipe_Move:
public function _MoveStage():void
{
//Pipes Move
for (var i:int; i < vPipeMax; i++)
{
var _Pipe = PipeLayer.getChildAt(i);
if(_Pipe.hitTestPoint(_Player.x, _Player.y, true))
{
blink = true;
Remove(_White);
Game_Over = true;
}
else
{
if(_Pipe.x < 241 && _Pipe.x > 234){
ScoreReady = true;
}
else
{
ScoreReady = false;
two = true;
}
if(ScoreReady && two)
{
Score++;
Scores.text = Score.toString();
two = false;
}
if(_Pipe.x <= -20)
{
_Pipe.x = 640 + 100;
_Pipe.y = Math.random()*90;
}
_Pipe.x -= xSpeed;
}
}
}
Game_Restart:
public function restartButton(m:MouseEvent)
{
GOSign.y = 1000;
R_Button.y = 1000;
Scores.y = 105.65;
HighScore.x = 500;
ScoreReady = false;
two = true;
HighScore5();
_Player.x = 240;
_Player.y = 320;
//This is where I restart the position of the pipes
for (var i:int = 0; i < vPipeMax; i++)
{
var _Pipe = PipeLayer.getChildAt(i);
_Pipe.x = (i * 250) + 640;
_Pipe.y = Math.random() * 90;
}
rGame = true;
}
Iv been at this for about two weeks and can not fix it. Thank you for reading.
I have found my problem. It was a VERY stupid mistake and I cant believe it took me this long to figure it out. I forgot to reset a variable ~facepalm~. I guess you learn from your mistakes lol

AS3 Showing image after load is finish

So i'm loading picture from xml, and adding them into a movieclip called cv which has a holder called cHolder. Right now the problem is that while the preloader shows it is loading, the cv(s) appeared already. Is there anyway to show all the cv only after the images have finish loading?
Thanks.
for each (var projectName:XML in projectAttributes)
{
//trace(projectName);
var projectDP:XMLList = projectInput.project.(#name == projectName).displayP;
//trace(projectDP);
var cv:MovieClip = new cView();
catNo += 1;
cv.name = "cv" + catNo;
cv.buttonMode = true;
if(catNo % 5 == 0)
{
catY += 137;
catX = -170;
cv.x = catX;
cv.y = catY;
}
else
{
cv.x = catX;
cv.y = catY;
catX += 112;
}
var imageLoader = new Loader();
imageLoader.load(new URLRequest(projectDP));
TweenLite.to(cv.cHolder, 1, {colorTransform:{tint:0x000000, tintAmount:0.8}});
cv.cHolder.addChild(imageLoader);
cv.ct.text = projectName;
projName.push(projectName);
this.addChild(cv);
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageProg);
function imageProg(e:ProgressEvent):void
{
loader.visible = true;
var imageLoaded:Number = e.bytesLoaded/e.bytesTotal*100;
loader.scaleX = imageLoaded/100;
}
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoad);
function imageLoad(e:Event):void
{
loader.visible = false;
}
First, don't put a function inside another function, this won't help for anything and is a bad habit :)
Declare two private variables:
var nImages:uint;
var loadedImages:uint;
Before the loop:
nImages = projectAttributes.length();
loadedImages = 0;
cv.visible = false;
and in the Event.COMPLETE listener:
function imageLoad(e:Event):void
{
loader.visible = false;
loadedImages++;
if (loadedImages == nImages)
{
cv.visible = true;
}
}
var count:int = 0;
var totalClips:int = 0;
cv.visible = false;
for each (var projectName:XML in projectAttributes)
{
++totalClips;
//trace(projectName);
var projectDP:XMLList = projectInput.project.(#name == projectName).displayP;
//trace(projectDP);
var cv:MovieClip = new cView();
catNo += 1;
cv.name = "cv" + catNo;
cv.buttonMode = true;
if(catNo % 5 == 0)
{
catY += 137;
catX = -170;
cv.x = catX;
cv.y = catY;
}
else
{
cv.x = catX;
cv.y = catY;
catX += 112;
}
var imageLoader = new Loader();
imageLoader.load(new URLRequest(projectDP));
TweenLite.to(cv.cHolder, 1, {colorTransform:{tint:0x000000, tintAmount:0.8}});
cv.cHolder.addChild(imageLoader);
cv.ct.text = projectName;
projName.push(projectName);
this.addChild(cv);
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageProg);
function imageProg(e:ProgressEvent):void
{
loader.visible = true;
var imageLoaded:Number = e.bytesLoaded/e.bytesTotal*100;
loader.scaleX = imageLoaded/100;
}
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoad);
function imageLoad(e:Event):void
{
++count;
if(count == totalClips){
cv.visible = true;
}
loader.visible = false;
}
}
So you might want to adapt things a little, in case I'm counting in the wrong spots etc for your implementation but as you can see the solution is simple, you count the total number of clips being processed for loading from the XML, then as the images are loaded and call the OnComplete callback, you increment another count until you've seen that you've loaded all processed images, and set the container to visible.

Tweener fade with alpha

I'm having troubles with getting my textfield to fade from alpha 0 to alpha 1 with Tweener.
Everything else works fine, so I suspect it has something to do with applying my textformats on the textfield?
This is my code
private function swapText(e:Event):void {
applyTextFormats();
addChild(_textContainer);
var textfromx:int = _xmlData.image[_currentActiveSlide].textfromx;
var textfromy:int = _xmlData.image[_currentActiveSlide].textfromy;
var textendx:int = _xmlData.image[_currentActiveSlide].textendx;
var textendy:int = _xmlData.image[_currentActiveSlide].textendy;
_textTimer.stop();
var texteffectDuration:uint = _xmlData.image[_currentActiveSlide].texteffectduration;
var texteffectType:int = _xmlData.image[_currentActiveSlide].texteffecttype;
_effectDelay = _xmlData.image[_currentActiveSlide].effectdelay;
if(texteffectType == 1) {
_textContainer.x = textfromx;
_textContainer.y = textfromy;
Tweener.addTween(_textContainer, { x:textendx, y:textendy, time:texteffectDuration, onComplete:function() { _slideTimer.start(); } } );
}
else {
_textContainer.alpha = 0;
_textContainer.x = textendx;
_textContainer.y = textendy;
Tweener.addTween(_textContainer, { alpha:1, time:texteffectDuration, onComplete:function() { _slideTimer.start(); } } );
}
}
private function applyTextFormats():void {
_textContainer.text = _xmlData.image[_currentActiveSlide].imgtext;
_textContainer.width = _imgWidth;
_textContainer.height = 40;
_formatsText.size = _xmlData.image[_currentActiveSlide].fontsize;
_formatsText.align = TextFormatAlign.CENTER;
_formatsText.color = _xmlData.image[_currentActiveSlide].fontcolor;
_formatsText.font = _xmlData.#fontface;
if (_xmlData.image[_currentActiveSlide].fontbold == 1) {
_formatsText.bold = true;
}
else { _formatsText.bold = false; }
_textContainer.setTextFormat(_formatsText);
}
make sure you are embeding the fonts properly and to set textField.embedFont=true.