Newbie needs help~

:hugegrin:

okie I got my php working with all the results i need…
albumId=0&albumName=default1&albumId=1&albumName=default2

now how do i work this within flash? bascially for each pair of albumId and albumName, I want to attach a movieclip to a empty container.

I tried the tutorials and loadVars but dun quite seem to get it right… what is the standard procedure for me to get the result from the php file within flash? and how do i work with it?

thanks a million

a bit more info…
i tried this quote in the frame for a test movie and it doesn’t work… :frowning:

myVars = new LoadVars(); 
myVars.load("http://www.fakedevil.com/albums2.php");
myVars.onLoad = function(){
    if(success){
        trace("variables loaded");
     } else {
        trace("Error loading page");
    } 
}

keeps giving me error loading page…

Howdy… :slight_smile:

That probably is where your problem lies…

You have to make sure that your PHP file spits out the valid output that Flash can understand…

If I run this, http://www.fakedevil.com/albums2.php, over the IE, I get this…

Warning: main(config.php): failed to open stream: No such file or directory in /home/eudora/public_html/albums2.php on line 3

Warning: main(): Failed opening ‘config.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/eudora/public_html/albums2.php on line 3

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/eudora/public_html/albums2.php on line 6
completed=true

That means that your PHP script has problem that you need to fix BEFORE you go on and supply that data to Flash…

i get this error on mine

Parse error: parse error, unexpected $ on line 20

all i did was copy the code straight out of the tutorial but put in my own db location username and password

Well… I don’t know what you are talking about, sizzle… Does your question belong to this thread??? In other words, are you another entity of the eudora??? :smiley:

At any rate, post your code and somebody will try to help you… (Nobody knows which tutorial you are talking about, so it’s best to post what you have…)

**** it i posted in the wrong thread on accident
my multitaskin skills are lacking today :stuck_out_tongue:

It does look like it… Go get some rest and fresh air… That’ll make it better… :slight_smile:

hmmz… think i got the cached page earlier… thanks let me look into taht

edit : how abt this one?
http://www.fakedevil.com/lurgee/albums2.php
i tried with this url same error trace

how abt this one?
http://www.fakedevil.com/lurgee/albums2.php

This works fine…


myVars = new LoadVars();
myVars.onLoad = function(success)
{
	if (success)
	{
		trace("variables loaded");
		trace(unescape(this));
	}
	else
	{
		trace("Error loading page");
	}
}
myVars.load("http://www.fakedevil.com/lurgee/albums2.php");

Make sure that you define onLoad before you actually use load() function…

oic!
haha thanks!! now i can continue… :slight_smile:

edited:

from http://www.fakedevil.com/lurgee/albums2.php
i got…
completed=true&album0=album1&album1=…

now how do i get the myVars.completed?
do i place it here?

myVars.onLoad = function(success)
{
    if (success)
    {
        trace("variables loaded");
        trace(unescape(this));
		**trace(this.completed);**
    }
    else
    {
        trace("Error loading page");
    }
}

a bit of progress…

myVars = new LoadVars();
**myVars._path = this;**
myVars.onLoad = function(success) {
	if (success) {
		trace(" variables loaded ");
		i = myVars.albumCount;

with that i can get the myVars.albumCount…
am i right to say that the value of i only exists within the onLoad function?
how can i access the other objects from within this function? _root.Object1?

edited… still got some problems…

this is my current code

myVars.onLoad = function(success) {
	if (success) {
		trace(" variables loaded ");
		nodeNum = 0;
		while (myVars['album'+nodeNum] != undefined) {
			// value of the duplicates radio
			container.entryHolderMC.attachMovie("link", "nodeMC"+nodeNum, nodeNum);
			container.entryHolderMC["nodeMC"+nodeNum]._x = 1;
			container.entryHolderMC["nodeMC"+nodeNum]._y = 2+nodeNum*20;
			container.entryHolderMC["nodeMC"+nodeNum].output = myVars['album'+nodeNum];
			container.entryHolderMC["nodeMC"+nodeNum].hitArea.onRollOver = function() {
				myTextFormat2.bold = false;
				myTextFormat2.color = 0xEBC7A4;
				myTextFormat2.applyChanges();
				container.entryHolderMC["nodeMC"+nodeNum].link1.setTextFormat(myTextFormat2);
			};
			container.entryHolderMC["nodeMC"+nodeNum].hitArea.onRollOut = function() {
				myTextFormat2.bold = false;
				myTextFormat2.applyChanges();
				myTextFormat2.color = 0xFFFFFF;
				container.entryHolderMC["nodeMC"+nodeNum].link1.setTextFormat(myTextFormat2);
			};
			container.entryHolderMC["nodeMC"+nodeNum].hitArea.onPress = function() {
				this.buttonHit = container.entryHolderMC["nodeMC"+nodeNum].output;
			};
			container.entryHolderMC["nodeMC"+nodeNum].hitArea._width = container.entryHolderMC["nodeMC"+nodeNum].link1.textWidth+2;
			container.entryHolderMC["nodeMC"+nodeNum].hitArea._height = container.entryHolderMC["nodeMC"+nodeNum].link1.textHeight+2;
			nodeNum++;
		}

so for each album i will attach a button MC… i tried to add in the onRollOver etc functions to it but that don’t seems to work. I tried the same code with XMl and it worked… anyone knows why?

anyone pls?
:book:

Got a sample that I can try??? :slight_smile:

thanks!
i made a typo of not declaring the textFormat earlier… but after declaring still no difference… the onPress is obviously working cos i got the trace of a msg… but onRollOver and onRollOut dun seems to work…

Try this…


container.entryHolderMC["nodeMC"+nodeNum].hitArea.onRollOver = function() {
				myTextFormat2.bold = true;
				myTextFormat2.color = 0xEBC7A4;
				myTextFormat2.applyChanges();
				this._parent.link1.setTextFormat(myTextFormat2);
};
container.entryHolderMC["nodeMC"+nodeNum].hitArea.onRollOut = function() {
				myTextFormat2.bold = false;
				myTextFormat2.applyChanges();
				myTextFormat2.color = 0xFFFFFF;
				this._parent.link1.setTextFormat(myTextFormat2);
};

whew! thanks! can explain a bit to me why we use this._parent?

and how can i make the album name appear in the textbox i created in the main timeline onpress?
:slight_smile:

edited… i got the textbox thingy… think I understand the rationale now… :slight_smile:

When you say ‘this’ from that onRollOver handler block, it refers to the button’s hitArea instance and the one you need to refer to is the one that is one level above that one, hence ‘this._parent’ comes in… :slight_smile: