473,699 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

createTextField with createEmptyMovi eClip

63 New Member
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 "someXCoorComin g" 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 4172
rsdev
149 New Member
Your textfield/label is over writing the previous one because you're not inctrementally naming themm.

_root.createTex tField("textFie ldName"+i etc...

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

_root.createTex tField("textFie ldName"+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 New Member
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
2248
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 created a few functions to aid in making this process work semi-cross-browser. (I develop in FF, but everyone who uses it will be using IE6.) function attachEvent(_obj, _evt, _fnc) { _evt = _evt.toLowerCase(); if (_obj.attachEvent) {
1
2895
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 or previous ten database records. When previous or next are clicked I want to remove the movie clips previously created using titleMC = _root.sub_nav_mc.createEmptyMovieClip("articleTitleMC" + i, ...
0
1936
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 go to my choosen page. Below is the script,please any one tell me how to put all of my images to one rectangle which later i can resize it,and load the image slideshow when i open choosen page. script: layer proto: MovieClip.prototype.alpha =...
1
2442
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 can do that? here is code: Choped: ...... function callFullImage(myNumber) { // call full image once the thumb is clicked myURL = myImages.attributes.full_url; // name of the image to be opned myTitle = myImages.attributes.title; // name...
1
2614
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 would be for it to make the phrases move down the _y axis until they reach the limit of the container. The phrases need to then swap onto a container behind or drop depths so they are behind the other phrases and then make their way back up. The...
0
2304
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 when I click on the the galleries I can see the pervious gallery files. The gallery works like this: When you open the gallery there are links on top of the page where you can go to other gallery; with gallery one which has small thumbnails on...
1
2004
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, i have an XML with photos , at the moment are 7 photos in there. The code i have at the moment just simply reads from the xml all the photos adn display them in a movie clip . This is the code so far : step_sel_img.onRelease=function(){...
49
5960
anfetienne
by: anfetienne | last post by:
is it possible to add php array to vars in the swfobject code?
1
3640
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 image. my problem is i have captions to go with it and when i try to load the captions nothing happens or can be seen to be happening. i dont know where i am going wrong as i have no output or compiled errors var locVar = new Array();...
0
8704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9192
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8895
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6545
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.