|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Loading Data into Combo Box from HTML
I saw the post about loading a combo box from SQL and I thought to myself that must be helpfull, but, ah... no.
![]() Ok, I basically know enough to be dangerous. I understand certain thongs, but not really how to put them together, and I hoping someone out there will just give me a little bit of organization. I have written a fairly extensive intranet in PHP and MySQL, but in order to navagate to anywhere within it within three clicks, I basically have a ton of links at the top of each page, eating a lot of real estate. Not Good. The trouble is, the ENTIRE web site is db driven. Some stuff (different sections, links, contacts and archives, etc) are tied to the groups the logged in user is in, and some stuff (application defaults, preferences, etc) are tied to the user. When I wrote the site, I wrote it with the idea that nothing is available by default, and you only get what is specifically assigned. On the light side, I wrote a navigation panel in flash. It's small, easy to navigate, and I think it will add order where there was some chaos. This is good. As I said, everything is data driven, so I have to figure out how to pump the data in. Since I don't want to write to an external file, I'm guessing I need to build PARAM tags and add attribute/value pairs to the EMBED tag inside the OBJECT tag. I can do that very easily. Then it seems I need to do something with loadvariables, but I'm not sure what nor do I know where to put the actionscript. One of the things that puzzles me is how do you keep the swf from reading the variables over and over? Put the actionscript in a layer by itself? But what happens when it loops? Anyway, TIA. Wether I get an answer or not, I will probably troll this forum. I can help with networking, PHP, MySQL.
__________________
Thanks, CF |
|
#2
|
||||
|
||||
|
Found on Yahoo:
Code:
Hi Philip, Pass the variables as parameters to the Flash Movie like this: <param name="movie" value="flash/sondagem_dummy.swf?var1=value&var2=value&var3=value"> The variables will be available in the _root of the main timeline. Rui OK, apparently, I don't need to add PARAMs and a/v pairs in the EMBED (just append it onto the swf filename like a POST to a php page), but what is the "_root of the main timeline"? |
|
#3
|
||||
|
||||
|
_root is the base layer of the movie. If you have a variable (ie var1) in a movieclip called mc, you access it like this:
_root.mc.var1 if var1 was at the "_root of the main timeline" you access it with: _root.var1 This really is almost the same thing as the other post, just the variables are not coming from a seperate file, but in the object tag, so you don't have to use a loadvars() call. Last edited by blatant : August 4th, 2003 at 05:21 PM. |
|
#4
|
||||
|
||||
|
Thanks for your reply blatant. I'm sure that all makes a ton of sense, but to me, it contains no information. I'm paying attention, but I think I'm just new to this. It feels very much like the first time I was forced to program in vb <shudder>, where I did a lot of property setting, and not as much programming as I would have thought.
What if I don't have a movie clip? I just have a two frame fla file, where the first frame has a button to go to the second frame, and the second frame has a button to go to the first frame. I added another layer for a combobox and placed it on stage. Right there is where I'm stuck. I can dynamically generate anything I want in the html, but I don't know what to code where. I'm guessing I need to write an action script, but what does it look like, and what do I attach it to? Since the combobox is in another layer, not the main one, will I be able to load it? Man, I have looked a bunch of tutorials, but I must be rockheaded or something, cuz it's just not making sense. I'm sure the light will click on and I'll have the whole thing figured out at once, but until then, I'm hosed. |
|
#5
|
||||
|
||||
|
Think of everything as objects. If you place anobject on the stage you access it in actionscript using its name, and you access its properies and methods using dot notation: object.property or object.method()
For example, if you place a movieclip on the stage called "mc", you can set it to be invisible by writing: mc.visible=false; in actionscript. Similarly, the whole flash movie is an object that is always called "_root". You can also access that same movieclip called "mc" by writing: _root.mc.visible=false; In fact, when your actionscript is inside a movieclip, it is necessary to use _root to tell the actionscript to look for the object in the main movie instead of inside your movie clip. In your case, "_root of the main timeline" just means the main movie. Action script does not dependant on layers, so you can access your variables/objects from any layer. For an example of how to populate combo boxes, look up the addItem() method in the help, or look at the .fla I posted in "How to populate a combo box from ASP" I hope that helps clear things up. |
|
#6
|
||||
|
||||
|
So then, if I understand you correctly, I could additems to a cmbobox named cboSections in a movie clip like this:
Code:
_root.cboSections.addItem("HelpDesk", 2);
_root.cboSections.addItem("Projects", 4);
But where does the action script go? Should I use #initclip and #endinitclip? |
|
#7
|
||||
|
||||
|
One more thing... I added the combobox after I had set up a few frames. When I set the instance name, it does not appear to propigate to other frames. How do I handle this?
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Loading Data into Combo Box from HTML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|