-
[RESOLVED] Dynamic News System help please!
I am trying to create a dynamic news system with the assistance of PHP and mySQL. Basically, I want to create like an archive, so that when a new news item is added, it will be added onto the list, and a button will be created in flash that will use a goto action to display the news. How can I go about dynamically creating a button?
Been stumped for hours! Please help, thanks!
Last edited by pyramidhead; 12-02-2006 at 03:13 AM.
-
So I figured out how to create dynamically loaded button, simply by creating a dynamic text field with a certain variable, the value of which is called from a PHP script, and then converting it into a button. In the main movie, I created actions on frame 1 that simply say:
Code:
loadVariablesNum("messing2.php", 0, "POST")
So the button's text is dynamically loaded... but how would I go about creating an ongoing list of these buttons that is automatically updated when a new news item is added? As in, the user posts a new article for today, how can I create one of these dynamic buttons that would be on the top of a list of all the older news items?
Basically, I want something like ultrashock's latest news system. Thanks for any insight.
Last edited by pyramidhead; 12-02-2006 at 04:57 AM.
Reason: added a link
-
FK'n_dog
my 2c's
make a movieclip that contains button and textfield
give the clip a Linkage Identifier in the Library
get php to output the number of news items
use this number in a loop to attach clips to stage
hth
-
This sounds right... but I'm still pretty new to all this so might take me a while to turn that reply into complete english, unless someone can describe it a little better.
Thanks a lot for the reply though.
-
FK'n_dog
OK
I have a movieclip in the Library, with Linkage ID - clip
it has a textfield, instance name - txt
covering the textfield is an invisible (hit frame only) button, instance name - btn
bring the external variables into Flash and add them to arrays, so you have -
Code:
newsArray = ["item1","item2","item3","item4","item5"];
linkArray = ["link1","link2","link3","link4","link5"];
find the length of the array and use it in the loop -
Code:
len = newsArray.length;
for(var n=0; n!=len; n++){
this.attachMovie("clip","clip"+n,n+1000);
ref = this["clip"+n];
ref._x = 10;
ref._y = n*25;
ref.txt.text = newsArray[n];
buttons(ref,n); // create the button links
}
function buttons(cl,id){
cl.btn.onRelease = function(){
trace(linkArray[id]);
}
};
hope this is a little clearer
-
FK'n_dog
file attached,
uses a simple text file to hold the variables, and LoadVars to populate the textfields via the arrays.
you will have to get your php to output something similiar
-
Thanks so much for helping me out, a buddy and I have been stumped with this for forever, I really appreciate the time you put into your response.
Looks like it should work perfectly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|