all groups > flash data integration > july 2005 >
You're in the

flash data integration

group:

Newbie Flash PHP movie button



Re: Newbie Flash PHP movie button Nick824
7/24/2005 12:00:00 AM
flash data integration: Works great!!! I am moving all code to Frame 1 as you suggested. However I
did have a quick question on that. Where I use onClipEvent(load){button
release code}, I would now do something like
this.someInstance.someButton.onRelease=function.. Am I correct in saying that?
Newbie Flash PHP movie button Nick824
7/24/2005 12:48:12 AM
I have enclosed a link to my sample flash file so that anyone can see what I am
talking about...

http://www.moonark.com/Sample.fla

In the sample I have a movie clip embedded within another movie clip that
contains 2 movie clips that should act like buttons. I left them as a movie
clip because when I choose the button option, I lose all my animations when I
mouse over them. When the flash file loads, I pulls a PHP file from my site and
loads the top 2 news articles from my database. This way I do not have to keep
modifing the flash file. That works just fine. I am able to load the summary,
data and ArticleID into their respective fields. My movie clips that I would
like to use as buttons I cannot get to work. I have created them each as a
seperate instance. All of my links on the site appear the same so I wrapped
them up into a movie clip, but I can't put code into the origonal clip because
it will then effect every instance. I cannot figure out how when I click the
"buttons" in the encloded sample I can get them to build a query string to go
to a PHP page similar to http://www.moonark.com/content/getArticle.php?ID={the
ID contained in the corresponding text field}... This page doesn't yet exist
but if I can get it to go to that page all is well... I have been messing with
this for a few days, but I am new with flash, and can't quite figure it out.
Re: Newbie Flash PHP movie button LuigiL
7/24/2005 11:41:33 AM
Replace your script with the attached.
Note: the keyword 'this' inside the LoadVars onLoad handler points to the
LoadVars object. To reference the buttons you can use this.mvOpenArticle0 and
this.mvOpenArticle1 because 'this' now refers to the 'current' mc (without an
instance name in your fla BTW). I think you will get it but if you have any
questions...
Another matter: (a positive, constructive remark...)
You should try to put all of your code outside of your objects and put it on
frame 1 of your movie in a seperate layer. All of your objects should have
instance names to do this. Not only is it better and advised coding practise
but it's much easier to read and to correct, changed a few months from now...
and there are more reasons not to put the code on the objects themselves.
And... it is easier to get help. Only few are willing to examine a file with
all the code scattered around.



onClipEvent(load){
lvIn = new LoadVars();
lvIn.load("http://www.moonark.com/content/getNewArticles.php");
lvIn.onLoad = function(success) {
if (success) {
if (this.error !== undefined)
{
}
else
{
txtID0.text = this.ID0;
txtDate0.text = this.Posted0;
txtSummary0.text = this.Summary0;

txtID1.text = this.ID1;
txtDate1.text = this.Posted1;
txtSummary1.text = this.Summary1;
}
}
}
this.mvOpenArticle0.onRelease=function(){
trace("Clicked Article 0");
trace(txtID0.text);
getURL("http://www.moonark.com/content/getArticle.php?ID="+txtID0.text);
}
this.mvOpenArticle1.onRelease=function(){
trace("Clicked Article 1");
trace(txtID1.text);
getURL("http://www.moonark.com/content/getArticle.php?ID="+txtID1.text);
}
}
Re: Newbie Flash PHP movie button LuigiL
7/25/2005 6:56:30 AM
AddThis Social Bookmark Button