Avatar of jrmcintosh
jrmcintosh

asked on 

Flash 8 remoting - Outputting data within a button

I am very close on this, just need a nudge in the right direction. I have done this successfully using just text boxes (i.e. this["base"+i] like you'll see in the code below) but want to be able to show those textboxes in a button and then use the button click function to do something based on the data.

Here's what I have. I have a movie called btn_holder (it has a linkage of btn_holder). Within btn_holder I have a button called bluebutton (again linkage of bluebutton). Within bluebutton I have a movie called base (linkage base). Within base I have two textboxes: Title_txt and Description_txt are their instance names.

What I am trying to do is loop through a recordset and place the buttons on the stage dynamically with the data loaded into the textboxes. The buttons all show up fine but the text data isn't displaying, it just shows the generic values on each button.

I do have a trace on the button value as well as the database value being called. The trace for the button value says undefined and the database value is correct.

Here is my actionscript code...any help would make me more sane.

Thanks,
Jason


//Result handlers
 function getTitles_Result(rs){
      cant = rs.result.length //how many rows are in our recordset?
      for(var i=0; i<cant; i++){
            //Dinamic put buttons on stage and fetch data to them
            attachMovie("btn_holder", "btn_holder"+i, i, {_x:0, _y:(43*i)})
            this["btn_holder"+i].bluebutton.base.Title_txt.text = rs.result.getItemAt(i).tutorial_title
            this["btn_holder"+i].bluebutton.base.Description_txt.text = rs.result.getItemAt(i).tutorial_description
            
            trace(this["btn_holder"+i].bluebutton.base.Title_txt);
               trace(rs.result.getItemAt(i).tutorial_title);
      }
}
function onFault(f: FaultEvent ){
      trace("There was a problem: " + f.fault.faultstring );
}
var pc:PendingCall = myService.getTitles();
pc.responder = new RelayResponder(this, "getTitles_Result", "onFault" );
stop();
Adobe Flash

Avatar of undefined
Last Comment
Lunchy
Avatar of Zeffer
Zeffer
Flag of New Zealand image

not a database man..so I'll assume that part of it is correct as you have had it working
it seems right ..but a couple of syntax errors...   ;   ... is missing on lines of code for the text paths..(and they sneak past the code checker)..but it is a compilation symbol..so could be that
and.. (f:FaultEvent) .. no spaces .. not so important but the player can be picky these days
any help?

Z
Avatar of Zeffer
Zeffer
Flag of New Zealand image

oh yea and the trace..try
trace("" + this["btn_holder"+i].bluebutton.base.Title_txt.text);

Z
Avatar of jrmcintosh
jrmcintosh

ASKER

Ok so I was able to get it to work by taking the button layer out. So now my code looks like this:

this["btn_holder"+i].base.Title_txt.text = rs.result.getItemAt(i).tutorial_title
            this["btn_holder"+i].base.Description_txt.text = rs.result.getItemAt(i).tutorial_description
            
            trace(this["btn_holder"+i].base.Title_txt);
               trace(rs.result.getItemAt(i).tutorial_title);

My data shows just fine, however, this is the next trick. I want to be able to click on the movieclips and have something happen. How do I know which movie clip that is created on the fly is clicked and how do I write code to cause it to do something on the click?
Avatar of Zeffer
Zeffer
Flag of New Zealand image

good work..it's obvious once it's pointed out....and ..I don't know!
as you answered your own question..I think you should ask to have this deleted and post a new one for your new question.
this one was just a path issue.. not of huge use..but the next will be valuable knowledge when it's answered.

Z
ASKER CERTIFIED SOLUTION
Avatar of Lunchy
Lunchy
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Adobe Flash
Adobe Flash

Adobe Flash (formerly Macromedia Flash) is a cross-platform multimedia and software platform used to embed animations, video, and interactive applications into web pages and desktop and mobile applications and games. Flash displays text, vector and raster graphics to provide animations, video games and applications. It allows streaming of audio and video, and can capture mouse, keyboard, microphone and camera input. The ActionScript programming language allows creation of interactive animations, video games, web applications, desktop applications and mobile applications.

29K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo