# onPress and while

**URL:** <https://forum.kirupa.com/t/onpress-and-while/63360>\
**Category:** flash\
**Created:** [September 6, 2004, 1:10am UTC](https://forum.kirupa.com/t/onpress-and-while/63360 "2004-09-06T01:10:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzman121](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jazzman121/32/127_2.png) [@jazzman121](https://forum.kirupa.com/u/jazzman121)\
**Post date:** [September 6, 2004, 1:10am UTC](https://forum.kirupa.com/t/onpress-and-while/63360/1 "2004-09-06T01:10:39Z")

</div>

```auto

loadText = new LoadVars();
loadText.load("data.php?"+random(999));

loadText.onLoad = function() {

i=0;
        while(i<30) {
                _root.movieclip["b"+i].onPress = function() {
                _parent.blacktext.text = loadText["datas"+i];
	   }
                i++;
        }

}

```

This code basically takes varaibales from php page that outputs this

```auto
 
&datas0=test&datas1=testtest 
  ........ all the way to ..&datas29=testtesttest

```

anyways this doesnt work… doesnt anyone know why? when i click the button in flash i want the corresponding datas ( data ) to show up… in blacktext.text

please help…

i hope that makes sense

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 6, 2004, 4:15am UTC](https://forum.kirupa.com/t/onpress-and-while/63360/2 "2004-09-06T04:15:49Z")

</div>

put a trace in the onLoad and see if it shows up.  
if it doesnt (i think it will not) put the onload in the next frame.

if it does, put a trace in the onPress

and instead of loadText use \_parent.loadText

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 6, 2004, 7:47am UTC](https://forum.kirupa.com/t/onpress-and-while/63360/3 "2004-09-06T07:47:40Z")

</div>

the onLoad works thats for sure… if i place

\_root.movieclip.b1.onPress

it works fine…
