FORUMS: list search recent posts

adding text from database to animated button

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Frank Feijen
adding text from database to animated button
on Jan 26, 2009 at 9:50:34 pm

Hi there,

i'm trying to create animated buttons in flash cs3,
i'm using a mysql-database to store the data (buttonname and urllink)
i use amfphp to create the connaction between flash and mysql.

Problem lies in adding the buttonname to my buttons, inside the button "btn", i've added a dynamic textfield with instancename "txt", but when i run the script i get TypeError: Error #1034: Type Coercion failed: cannot convert "Home" to flash.text.TextField.

import flash.net.*;
import flash.text.TextField;
import flash.text.TextFieldType;


var gw:NetConnection = new NetConnection();
gw.connect("http://mysite.com/amfphp/gateway.php");

var res:Responder = new Responder(onResult, onFault);

function onResult(responds:Object):void
{
var t:Array = responds.serverInfo.initialData;
for(var i:uint=0; i<t.length; i++)
{
var Btn:btn = new btn();
Btn.x = (50 + i * Btn.width)-50;
Btn.x = (50 + i * Btn.width)-50;
Btn.y = 0;
Btn.buttonMode = true;
Btn.txt= (t[i][0]);
trace (Btn.txt);
Btn.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
Btn.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);


}
}

function onFault(responds:Object):void
{
for(var i in responds)
{
trace(responds[i]);
}
}

gw.call("topmenu.getTopMenuData", res);



function onButtonOver(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("over");
trace ("over");
}

function onButtonOut(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("out");
trace ('out');
}



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]