473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

createTextField with createEmptyMovieClip

Hi everyone,

I am starting to dabble with using flash as an interface for php and mysql and, while I could do what I want to do in AJAX, it wouldn't be as pretty. So I grabbed some code and started hacking. What a surprise that it's not working! I know, I know, but everything is functioning except for one thing.

I can retrieve the data with no problem using LoadVars via PHP and MySql, but my problem has to do with assigning a label of some sorts to each jpeg, namely the name of the jpeg itself.

I can do that, but the label/textfield is only there for an instant, until the next label/textfield is generated. It appears exactly where it is suppose to appear underneath the jpeg for which it represents.

The variable being passed "someXCoorComing" is actually the pic._x

Here's the code:
Expand|Select|Wrap|Line Numbers
  1. function onLoadInit(pic:MovieClip) {
  2.     pic._width = 150;
  3.     pic._height = 100;
  4.     pic._x = 8 + 166*ipic;
  5.     pic._y = 10;
  6.     pic._alpha = 100;
  7.     pic.filters = [picShadow];
  8.     if (++ipic < pics.length) loadPic(pic._x);
  9. }
  10.  
  11. function loadPic(someXCoorComing) {
  12.     holder.createEmptyMovieClip("p"+ipic,ipic);
  13.     holder["p"+ipic]._alpha = 0;
  14.     mcl.loadClip("http://www.mydomain.com/registration/images/" + pics[ipic], holder["p"+ipic]);
  15.     myLabelFunc(someXCoorComing);
  16. }
  17.  
  18.  
  19. function myLabelFunc(someXCoorComing)
  20. {
  21. //var txtFormat:TextFormat = new TextFormat();
  22. obj = _root.createTextField("mctext",0,someXCoorComing,200,1000,100);
  23. mctext.multiline = true;
  24. mctext.wordWrap = true;
  25. mctext.border = false;
  26.  
  27. mcformat = new TextFormat();
  28. mcformat.color = 0x5AF416;
  29. mcformat.bullet = false;
  30. mcformat.underline = true;
  31.  
  32. mctext.text = pics[ipic];
  33. mctext.setTextFormat(mcformat);
  34.  
  35. return obj;
  36. }
  37.  
Thanks in advance,
Tarik
Oct 18 '07 #1
3 4159
rsdev
149 100+
Your textfield/label is over writing the previous one because you're not inctrementally naming themm.

_root.createTextField("textFieldName"+i etc...

Hope this helps.
Oct 19 '07 #2
Your textfield/label is over writing the previous one because you're not inctrementally naming themm.

_root.createTextField("textFieldName"+i etc...

Hope this helps.
Yeah, I actually thought of that, but then what do I do for setting the ".text = pics[ipic]"

Expand|Select|Wrap|Line Numbers
  1.  
  2. var myTempVar = "mctext"+ipic;
  3. var obj:TextField = _root.createTextField("mctext"+ipic,0,someXCoorComing,180,100,20);
  4.  
  5. mcformat = new TextFormat();
  6. mcformat.color = 0x000000;
  7.  
  8. eval(myTempVar).text = pics[ipic];
  9. eval(myTempVar).setTextFormat(mcformat);
  10. return obj;
  11.  
  12.  
Oct 19 '07 #3
rsdev
149 100+
Yeah, I actually thought of that, but then what do I do for setting the ".text = pics[ipic]"

Expand|Select|Wrap|Line Numbers
  1.  
  2. var myTempVar = "mctext"+ipic;
  3. var obj:TextField = _root.createTextField("mctext"+ipic,0,someXCoorComing,180,100,20);
  4.  
  5. mcformat = new TextFormat();
  6. mcformat.color = 0x000000;
  7.  
  8. eval(myTempVar).text = pics[ipic];
  9. eval(myTempVar).setTextFormat(mcformat);
  10. return obj;
  11.  
  12.  
You use;

Expand|Select|Wrap|Line Numbers
  1. _root["mctext"+ipic].text = pics[ipic];
I often wish .NET was this easy.
Oct 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Chris Lieb | last post by:
I am trying to add an event listener to the keyup event for some text inputs that I am creating dynamically. I have no problems getting it to work in Firefox, but IE just ignores them. I have...
1
by: Sebarry | last post by:
Hi, I have a actionscript script that retrieves data from the database and creates a movie clip with a text field to store the data. I have next and previous buttons to navigate to show the next...
0
by: shaqa | last post by:
I try to do this but i cannot. i creat two layers with actionscript seperated as slideshow need to be,,and i try to put in one rectangle all of my images but cannot put in work,it doesnt load when i...
1
by: creative1 | last post by:
I have designed a gallery using XML FILE. File uploads the thumbnails and displays the big image on click of the image. I wan to open a site on click of the bigger image. Can someone help me how I...
1
by: chromis | last post by:
Hi, I've been trying to create a carousel class which takes an array of phrases and then creates a textfield for each one positioning it vertically based on the order it was added. The next stage...
0
nomad
by: nomad | last post by:
Hello Everyone. I founded an Flash and xml photo gallery. It works but I took it to another step What I want is to have six different galleries in one Flash file. I figure out how to do that but ...
1
by: onyris | last post by:
Hi guys , I have got lost a bit with this flash i am doing at moment , i will try to explain the best i can and i'll post the code as well so u can see what i've done . I am using Action script 2,...
49
anfetienne
by: anfetienne | last post by:
is it possible to add php array to vars in the swfobject code?
1
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.