I load a PHP variable with Loadvar and...
Though I described my problem... I am importing a PHP var, it
loads perfectly the first time, but then it keeps the same value
and I need to load the new value each time I go the page contains
the code..... any suggestion please ? It is very urgent, thanks in
advance,
The thing is you'll need to refresh your cache so that it
reads the updated valur of your php value. There is a quick work
around / hack to this:
Whenever you load your php script just add a simple time
based extra value to it, it won't change the way the script works,
but it'll make the movie think its loading a different file
everytime, so ther won't be any mistake:
var d:Date=new Date();
LoadVarsObject.load('file.php'+d.getTime());
Cheers,
Gorka
www.AquiGorka.com
Similar Messages
-
Problem with LoadVars and stopping/playing
I've got a flash movie set up online that isn't working
properly. The details are this: the movie has two frames, the first
being a blank loading frame meant to keep anything from being
displayed till the variables are delivered by my PHP script, and
the second being the frame with the actual movie content.
The actionscript I use on the first frame is as follows:
quote:
names = new LoadVars();
names.onLoad = function() {
gotoAndStop(2);
names.load("txt?id="+"EBfig298x"+"&"+secure);
stop();
The
"txt. . .secure bit is the location of my PHP script that
delivers the necessary variables. I know that the PHP side of
things is working because the flash program DOES load all the
variables in exactly as I want it to. The problem I am having is
that when played, the program stops indefinitely on frame 1. I have
to right-click and force the program to play before it flickers
past frame 2 (the content) and back to the loading frame, where it
then loads the variables and plays like it's supposed to.
You can play the flash movie at
http://images4u.com/thumbs_i4u.php?play=EBfig298x.swf
As I described above, it remains blank indefinitely, so you
will need to force it to play to see what I'm talking about.
I'd appreciate any help you guys can give to get the movie
playing automatically as it should.The first time flash attempts to do the loading, there
appears to be a 301 redirect from images4u.com to www.images4u.com
for the requested text data.
This then appears to sent... but then flash requests a
crossdomain.xml file from www.images4u.com and it receives none
(404 not found).
At that point I assume that the LoadVars onLoad does not
trigger.
The second time around it requests it from the
www.images4u.com domain and there is no problem - it doesn't seem
to need a crossdomain.xml permission.
So the problem is with the redirect. I don't know exactly the
solution. I would guess either make the request from flash to
www.images4u.com/etcetera or put a crossdomain.xml at your sites
root covering both www.images4u.com and images4u.com in terms of
permissions. -
Loading New Substitution Variables with Esscmd Script
Hi, I posted a topic awhile ago and haven't gotten any responses to help. I was wondering if tehre is a script to load NEW substitution variables into a database using an ESSCMD script. The UPdatevariable doesn't work if you don't already have variables in teh database loaded. I need to load them in. THANKS
while I have not had luck with ranges in report scripts, others have. You could have a substitution variable the is "Jun" "Jul " "Aug" or whatever you want the members to be. and it will replace jusr fine
-
Macbook not loading past white screen with logo and spinnning wheel?
ok, so basically i have a macbook 10.6.4 Snow Lepoard that is making me want to literally bash its brains out but, unfortunatly i cant because it is owened by the school...
As mentioned in previous posts, my school It dept are incredibly slow and their idea of fixing something is to wipe everthing and reinstall all the programs once again. if that dosent work their other way of fixing something is to send it off to apple. for obveous reasons i want to avoid that.
it ONLY started today, (last night i was happily doing last minuite homework) when its was lagging so much that i did the inevitable, i quit tetris and restarted my computer...
This led to me sitting infront of a white screen and a spinning wheel for the whole lesson. The next lesson i got fed up with waiting and restarted. nothing. I have also notied that my macbook seems to heat up REALLY FAST toward the bottom of the screen (where is says macbook).
Any suggestions?
Thanks in advance,
Favviwell i went to hand it in today but the fails that we call 'the qualified IT deptarment' (even though they are only two), decided to take the day off. they were supposed to be there recess and lunch but the room was pitch black.
When you say that "you do not need admin rights to perform the different solution", i actually am the admin of the laptop but there is another hidden admin so that they can change any settings in the computer without our passwords.
i have previously tried that whole command letter thing for various other things such as safe mode and starting from the disk and have had no sucess. i dont know if my timing is off or something but it never works. however, i have been able to retrive a disk from the disk drive by pressing the mouse button when it turns on.
this is an exerpt from a previous post:
favvi wrote:
so im really starting to get annoyed now. I have tried that single user mode start up thing (command + s) after the chime, before the chime, hold it down for a second, hold it down forever BUT IT ALWAYS JUST GOES INTO MY LOGIN SCREEN!!! i cant seem to get around this. I cant get into the 'utilities' from my install disk because it asks for an admin name and password. i am literally tearing my hair out…
Barney-15E:
That doesn't make any sense. When it boots to the install disk, there is no user to authenticate.
Does it have an Open Firmware password set?
i assumed that this was set. but to be honest i have no freaking idea.
also i was talking to a friend today and she said that she had the same issue and they had to replace the battery. although i have no idead on how the battery could be affecting this? -
Time variables with if and else statements for class script
Hello, for an in class assignment to create a script using random generated answers im trying to get the script set up for different answers depending on the time of day here is what i have so far, in bold is my second time that i would like to have if the
time is 6pm, the one that works right now is the one that is anything greater then 12pm and the one that is everything before 12pm the 6pm will not work:
#Clear the Windows command console screen
Clear-Host
#Define the variables used in this script to collect player inputs
$question = "" #This variables will store the player's question
$status = "Play" #This variable will be used to control game termination
$answer = 0 #This variable stores a randomly genrated number
$time = (Get-Date).Hour #This variable stores the current hour of the day
#Display the game's opening screen
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host " W E L C O M E T O T H E W I N D O W S"
Write-Host
Write-Host
Write-Host
Write-Host " P O W E R S H E L L F O R T U N E T E L L E R"
Write-Host
Write-Host
Write-Host
Write-Host " By Zelandra"
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host " Press Enter to continue."
#Pause script execution and wait for the player to press the Enter key
Read-Host
#Clear the Windows command console screen
Clear-Host
#Provide the player with instructions
Write-Host
Write-Host " The fortune teller is a very busy and impatient mystic. Make"
Write-Host
Write-Host " your questions brief and simple and only expect to receive"
Write-Host
Write-host " Yes / No styled answers."
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host " Press Enter to continue."
#Pause script execution and wait for the player to press the Enter key
Read-Host
#Continue game play until the player decides to stop
while ($status -ne "Stop") {
#Ask the player the first question
while ($question -eq ""){
Clear-Host #Clear the Windows command console screen
Write-Host
$question = read-host " What is your question? "
$question = "" #Reset variable to a empty string
#Retrieve a random number between 1 and 7
$answer = Get-Random -minimum 1 -maximum 8
#If it is the night the fortune teller will be a little more cranky
if ($time -gt 18) {
Write-Host
if ($answer -eq 1) { " Grrrr. The answer is NO, now let me get back to sleep!" }
if ($answer -eq 2) { " Grrrr. The answer is !!!NEVER!!!" }
if ($answer -eq 3) { " Grrrr. The answer is unclear, did you really think i would know?" }
if ($answer -eq 4) { " Grrrr. The answer is sure whatever!" }
if ($answer -eq 5) { " Grrrr. Even if i wanted to tell your fortune i wouldnt!" }
if ($answer -eq 6) { " Grrrr. Look at the time, im busy SLEEPING!" }
if ($answer -eq 7) { " Grrrr. Take whatever answer you want and leave me alone!" }
#Select an answer based on the time and the random number
#If it is the afternoon the fortune teller will be a little cranky
if ($time -gt 12) {
Write-Host
if ($answer -eq 1) { " Grrrr. The answer is no!" }
if ($answer -eq 2) { " Grrrr. The answer is never" }
if ($answer -eq 3) { " Grrrr. The answer is unclear!" }
if ($answer -eq 4) { " Grrrr. The answer is yes!" }
if ($answer -eq 5) { " Grrrr. The answer is absolutely not!" }
if ($answer -eq 6) { " Grrrr. The answer is unforseeable!" }
if ($answer -eq 7) { " Grrrr. Im sorry could you repeat that?" }
#If it is morning the fortune teller will be in a good mood
else {
Write-Host
if ($answer -eq 1) { " Ah. The answer is yes!" }
if ($answer -eq 2) { " Ah. The answer is Always" }
if ($answer -eq 3) { " Ah. The answer is uncertain!" }
if ($answer -eq 4) { " Ah. The answer is no!" }
if ($answer -eq 5) { " Ah. The answer is there is a fair cha... OH LOOK A SQUIRREL!" }
if ($answer -eq 6) { " Ah. I think you meant to ask something else!" }
if ($answer -eq 7) { " Ah. Well it looks like your wish will be ready tonight!" }
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host " Press Enter to continue."
#Pause script execution and wait for the player to press the Enter key
Read-Host
#Clear the Windows command console screen
Clear-host
Write-Host
#Prompt the player to continue or quit
$reply = read-host " Press Enter to ask another question or type Q to quit."
if ($reply -eq "q") { $status = "Stop" }
#Clear the Windows command console screen
Clear-Host
#Provide the player with instructions
Write-Host
Write-Host " Very well then. Please return again to get all your questions"
Write-Host " answered."
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host
Write-Host " Press Enter to continue."
#Pause script execution and wait for the player to press the Enter key
Read-Host
#Clear the Windows command console screen
Clear-Host
Thanks again if anyone can provide help.Hi,
Use -and in your afternoon if test.
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing) -
Change php variable with javascript??
Hey Guys
I need to know how can i send the form to a different email address if someone selects an option from the "BSU(area)" on the HTML from.
So basically if the are on the html form and they select NewCastle from the "BSU(area)" for example i want the script to change the email address to the address assigned to that option.
How can i achieve this? If you guys need to see my PHP script let me know.
Help please!!
Here's the link: http://flyingant.co.za/invite.html
yours
AshveerYes i agree with you.
Here's my script tell me where i am going wrong?
<?php
// Build message.
$my_email = "";
global $my_email;
function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
$message = build_message($_REQUEST);
$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
$message = stripslashes($message);
$subject = "Form To Email Comments";
$headers = "From: " . $_REQUEST['Email'];
mail($my_email,$subject,$message,$headers);
?>
<?php
function getValue($Result){
//$Item = form.BSUarea.selectedIndex;
$Item = $_POST["BSUarea"];
//$Result = form.BSUarea.options[Item].text;
$Result = $_POST["BSUarea"];
switch ($Result) {
case ($Result = "Gauteng"):
//$Gauteng = "[email protected]";
$my_email = "[email protected]";
//$my_email = $Gauteng;
break;
/*case ($Result = CapeTown):
CapeTown = "[email protected]";
$my_email = CapeTown;
break;
case ($Result = Richards_Bay):
Richards_Bay = "[email protected]";
$my_email = Richards_Bay;
break;
case ($Result = Pinetown):
Pinetown = "[email protected]";
$my_email = Pinetown;
break;
case ($Result = Pietermaritzburg):
Pietermaritzburg = "[email protected]";
$my_email = Pietermaritzburg;
break;
case ($Result = NewCastle):
New Castle = "[email protected]";
$my_email = NewCastle;
break;
case ($Result = George):
George = "[email protected]";
$my_email = George;
break;*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BSU - Evite</title>
</head>
<body>
<div class="main">
<div class="content"></div>
<form id="form1" name="myform" method="post" action="#build_message">
<table width="525" border="0">
<tr>
<td width="270"><label><strong>BSU(area)</strong></label></td>
<td width="10"> </td>
<td width="240" align="left">
<select name="BSUarea" id="BSUarea" onchange="getValue($Result)">
<option value="Durban">Durban</option>
<option value="Richards_Bay">Richards Bay</option>
<option value="Gauteng">Gauteng</option>
<option value="CapeTown">Cape Town</option>
<option value="George">George</option>
<option value="NewCastle" >NewCastle</option>
<option value="Pietermaritzburg" >Pietermaritzburg</option>
<option value="Pinetown">Pinetown</option>
<option value="Polokwane">Polokwane</option>
</select></td>
</tr>
<td width="270"></td>
<td width="10"> </td>
<td width="240"><label>
<input type="reset" name="Reset" id="Reset" value="Reset" />
<input type="submit" id="Submit" value="Submit" />
</label></td>
</tr>
</table>
</form>
</div>
</body>
</html> -
Get current HTML URL into flash with LoadVars and ColdFusion
I need to get the current page url and pass it into flash.
I'm also using ColdFusion. Is there an easy solution?I gave up on bringing in the URL and parse it into a string,
there is too much I don't understand. I put in two commands in the
HTML where the Flash movie is sitting:
1. <param name="FlashVars" value="airport=sbn"/>
2. and in <embed src I put in, Flashvars="airport=sbn"
"airport" is the variable in Flash (it is called as
"_level0.airport" in the Flash file) and "sbn" is the variable
definition for 12 of the files. I will just find "sbn" and replace
it with the new airport name in the next set. It's not very slick,
but it's better than having to create a new navigation for every
airport. Thanks for the help. -
PHP page with HTML and /HTML DOCTYPE ??
The sample forms that come with my formmail script start out
with a <php
and ?> then has embeded php code within the following
<html> - but no
DOCTYPE is specified.
Do I need a doctype in this kind of document?
Where should it to?
Above the initial <php?
After the ?> and before the <html>
OK - dumb question, but Quirks is bad and I don't know the
answer.
Dan H.
(I'm not ready for XHTML yet.)> The HTML 'will' validate but I expect the PHP will cause
the W3C valuator
> to
> hickup.
The W3C validator will never see the PHP since it will have
already been
stripped from the page by the server before uploading the
resulting HTML
page to the validator.
> Is there really any value to ending the document file
name with '.php'
> versus '.html'?
Of course if the page contains PHP then there is (unless you
have your
server set to parse all file extensions). And, in general,
there is a
benefit to naming all pages with *.php extensions in that if
you ever decide
to add PHP scripting to any page in your site, you don't have
to worry
about search engine ramifications when you change that file's
extension.
Good luck Dan!
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
<[email protected]> wrote in message
news:C5B9D4F2.241E4%[email protected]...
> Thank you Dave and Murray,
>
> This discussion is exactly what I needed.
>
> My plan is to produce <HTML> pages (ending in
'.html') that also contain
> PHP
> code ( <php ... ?> ) within the html arguments.
Some of this PHP will
> calculate filenames to link to.
>
> The pages will begin with an 'html 4.0.1 transitional...
Etc.' statement
> followed by the <head> ... etc.
>
> The HTML 'will' validate but I expect the PHP will cause
the W3C valuator
> to
> hickup. I'm guessing that this will NOT put me back into
'quirks mode'.
>
> Is there really any value to ending the document file
name with '.php'
> versus '.html'?
>
> BTW:
> I'll miss this forum. Everything I've learned about
Dreamweaver over the
> last several years and nearly everything I've learned
about coding - I've
> learned from reading posts in this forum by Dave,
Murray, Al, Patty,
> etc...
>
> Most of the information that is valuable to me came from
responses to
> questions asked by others.
>
> It's like the passing of a cherished era - you know -
like the '50s...
>
> I wish you good fortune my friends.
> I urge you to stick together, find an online home, and
let the rest of us
> know where it is so we can come and visit.
>
> Dan H.
>
> PS
> My neighbor says it's President Obama's fault!
> The fellow got elected preaching 'CHANGE'.
> Now everybody's doing it and nobody has any ;^]
> ...................................................
>
> [email protected] wrote:
>> Do I need a doctype in this kind of document?
>
> If it contains HTML, yes.
>
>> After the ?> and before the <html>
>
> Immediately before the opening <html> tag.
>
> ...................................................
> -
Php variable and xml processing
Hello there,
I have a problem that is driving me crazy! I have a php file
which creates an xml string from a sql query. The problem is that I
need to use a variable from an swf file to create the query. All
this should happen when i click a button on the swf page. The xml
file is created no problem but the variable is not used. i am well
able to use these POST variables in other php files. As you can see
the php file is called twice in the action script. Is this the
problem. The line: xmlData.load("get_max_sess.php"); is fine. I
stuck the other on one in - loadVariablesNum ("get_max_sess.php",
0, "POST"); after the fact and this doesn't work. is there a
confilct in calling the same file twice? Is the sendAndLoad
function an option? Also included below is my php file.
Thanks so much. I really hope you can help me!
****************************************************ACTION
SCRIPT**********************************
call_btn.onRelease=function(){
function processXMLData(success)
{loadVariablesNum ("get_max_sess.php", 0, "POST");
if (success)
var rootNode=this.firstChild;
var contentNode=findNode(rootNode, "guit_vol");
guitVol=getValue(contentNode);
var authorNode=findNode(rootNode, "guit_pan");
guitPan=getValue(authorNode);
var contentNode=findNode(rootNode, "guit_vis");
visGuit=getValue(contentNode);
_root.guitVis.gotoAndStop(visGuit);
//assign xml info to musician objects
_root.guitObj.drag._y=guitVol;
_root.guitObj.drag._x=guitPan*2;
else
content="Today's news is not found";
function getValue(node)
if (node && node.firstChild)
return node.firstChild.nodeValue;
return "";
function findNode(node, nodeName)
if (node.nodeName==nodeName)
return node;
for (var i=0; node.childNodes &&
i<node.childNodes.length; i++)
var foundNode=findNode(node.childNodes
, nodeName);
if (foundNode!=null)
return foundNode;
return null;
var xmlData=new XML();
xmlData.ignoreWhite=true;
xmlData.onLoad=processXMLData;//when xml data loads the
function at the top executes
xmlData.load("get_max_sess.php"); //loads the xml data from
this location
stop();
****************************************************PHP
FILE**********************************
<?php
$user_id=$_POST['user_id'];
// query database for records
$connection = mysql_connect('localhost', 'm27849_martin',
'Geraldine1') or die ("Unable
to connect!");
mysql_select_db('m27849_liveroom') or die ("Unable to select
database!");
$query = "
SELECT a.guit_sess_id, a.guit_vol, a.guit_pan, a.guit_vis,
b.bass_sess_id, b.bass_vol, b.bass_pan, b.bass_vis, c.drum_sess_id,
c.drum_vol, c.drum_pan, c.drum_vis
FROM guit_info a, bass_info b, drum_info c, users_sessions d
WHERE d.session_id =(SELECT max(a.session_id) FROM
users_sessions a WHERE a.user_id = '$user_id')
AND a.guit_sess_id = d.session_id
AND b.bass_sess_id =a.guit_sess_id
AND c.drum_sess_id = b.bass_sess_id
//(SELECT userid from auth WHERE username ='martin')
//here a variable could be inserted to call the relevant row
(session)
$result = mysql_query($query) or die ("Error in query:
$query. " .
mysql_error());
$doc = new DomDocument('1.0');
//The first element we create in the XML document is known as
the root element. Each XML document must have 1, and only 1, root
element. In this example I have called it 'root', but you can use
whatever name you like (such as the name of the PHP script which is
executing). Note that you have to create the element and insert it
into the document with two functions.
// create root node
while($row = mysql_fetch_assoc($result)) {
$user = $doc->createElement('session');
$user = $doc->appendChild($user);
foreach ($row as $fieldname => $fieldvalue) {
//Note that here I create a new element for the field and
then insert it as a child to the current database row, as
identified in $occ.
$child = $doc->createElement($fieldname);
$child = $user->appendChild($child);
//Now I must add the field value as a text node, then insert
it as a child element to the current field node, as identified in
$child.
$value = $doc->createTextNode($fieldvalue);
$value = $child->appendChild($value);
//These loops do not terminate until they have processed
every column of every row which has been retrieved from the
database.
} // foreach
} // while
echo $doc->saveXML();
//echo $doc->saveXML($child);
mysql_close($connection);
//from:
http://www.tonymarston.net/php-mysql/dom.html
?>Hi there,
I cracked it after a lot of to-ing and fro-ing! Apparently
you CAN send a variable and then load xml. Thanks so much for your
advice and interest. I am much obliged.
Marty Party
Check out my code below....
user_id=147;
submit_button.onRelease=function(){
function processXMLData(success)
if(success)
{_root.status_id="Success"
var rootNode=this.firstChild;
var contentNode=findNode(rootNode, "guit_vol");
guitVol=getValue(contentNode);
var authorNode=findNode(rootNode, "guit_pan");
guitPan=getValue(authorNode);
var contentNode=findNode(rootNode, "guit_vis");
visGuit=getValue(contentNode);
status_id=visGuit;
etc....
else
content="Today's news is not found";
function getValue(node)
if (node && node.firstChild)
return node.firstChild.nodeValue;
return "";
function findNode(node, nodeName)
if (node.nodeName==nodeName)
return node;
for (var i=0; node.childNodes &&
i<node.childNodes.length; i++)
var foundNode=findNode(node.childNodes
, nodeName);
if (foundNode!=null)
return foundNode;
return null;
var xmlData=new XML();
xmlData.ignoreWhite=true;
xmlData.onLoad=processXMLData;
//xmlData.load("get_max_sess.php");
var id:LoadVars = new LoadVars();
id.user_id = user_id;
//id.username = _root.username;
id.sendAndLoad("get_max_sess.php", xmlData, "POST");
Basic idea from
http://www.permadi.com/tutorial/flashXMLNewsExample/index.html
- Thank you!! -
Oracle support under PHP / 8i or 9 and a RedHat 9 / Apache 1.3.X machine
Hi,
I have a server (currently 7.1) with apache + php
compiled with oracle (and mcrypt, imap, gettext) support.
In order to do so I've installed the 8i linux
version, make a tar.gz of the libs directory and
installed in my server.
I runs fine accessing a remote (not mantained by me)
oracle database.
I am planning to switch to a newer distribution and
was considering the RH9 but with the "old" 1.3.x apache.
Since I do not actually use Oracle (just enable php
scripts to do so) I am kind of lost if the combo (old
8i libs with redhat 9) are stable enough or should I
try a newer version, such as oracle 9.
And in that case if is there a "developers" package/installation that enables me just to install the required libs/headers without having to actually install the whole db.
Since the answer can be slighty OT fell free to send
me directly.
Thanks.I'm in a similar situation where i'm migrating from Win2k + PHP & want oracle support to connect to a remote server.
I got as far as installing redhat 9 & installing the oracle client.
I still can't get oracle to work in PHP though. doing a bit of research I dont think the redhat 9 RPM's come with oracle support compiled. I really dont want to be maintaining custom compiled php versions i'd rather just have up2date do it all. I hear you can get ODBC to work with oracle, but most of the stuff i've looked at covers doing this on windows, not linux.
If anyone out there has manager to get PHP & oracle working on RH9, without re-compiling PHP please let me know! -
Photo gallery with buttons and php.
I am relatively new to actions script, very new to as3, and brand new to php. I have tried very hard to figure all of this out via tutorials, studying the code, etc but now I'm running out of time to get this done so I need some help.
I am trying to make a photo gallery that functions as follows:
-the php gathers all of the filenames from a folder and returns it to flash
-an array of buttons is loaded onto the stage (one for each photo)
-flash then loads the first image into a movie clip.
-when the user clicks on button[i], image[i] loads in the movie clip.
-i also plan to incorporate what might happen if the number of photos exceeds the number of buttons that can fit nicely on the stage, like an arrow to go to another set of buttons. I haven't tried coding this yet since I was just trying to get the thing to work in general first. If anyone has ideas about this, let me know.
Please don't make fun of me too much. I know it's probably a mess.
Thank you so much in advance for your help.
Here's the php:
<!--
Author: Adam Ehrheart
Site: http://adamehrheart.com
Blog: http://flashcamp.net
Date: 4.21.08
-->
<?php
# Use "." if the get_files.php file resides in the same directory as files being read
# Otherwise you can change the path to whatever you like
# eg:
# Same Directory:
# $path = ".";
# Other Directory
# $path = "products/images/"
$path = "Photography/";
# Choosing what directory to read
if ($handle = opendir($path)) {
# Temporary array to hold image files
$imageFiles = array();
# Creating loop and assigning current file to $file temp variable
while (false !== ($file = readdir($handle)))
# Checking wheter or not the file is invisible and starts with a "."
$fileCheck = substr($file, 0, 1);
# Checking to make sure the files is either a (jpg, JPG, png, PNG)
$fileType = substr($file, -3);
# Making sure file is not invisible
if($fileCheck != ".")
# Making sure file is readable and dynamically loadable by Flash
if($fileType == "jpg" || $fileType == "JPG" || $fileType == "png" || $fileType == "PNG")
# Adding File to the image array
if($path != "."){
array_push($imageFiles, $path . $file);
}else{
array_push($imageFiles, $file);
# Sorting the files alphabetically
sort($imageFiles);
# Creating XML File output to be read by Flash
echo "<?xml version=\"1.0\"?>\n";
# Root Node
echo "<image_list>";
# Creating child nodes for each image
foreach($imageFiles as $value)
# Pulling the Width and Height values for each file and adding them as attributes for the image node
list($width, $height) = getimagesize($value);
# Creating the image node
echo "<image width=\"$width\"" . " height=\"$height\">" . $value . "</image>";
echo "</image_list>";
# Closing the readdir function
closedir($handle);
And here's the as3:
//php photo section
import flash.events.Event;
import flash.net.*;
//load the php file
var myRequest:URLRequest = new URLRequest("Photography.php");
var myLoader:URLLoader = new URLLoader();
//define images variable as an xml file
var images:XML = new XML();
images.ignoreWhite = true;
images.addEventListener ('load', myLoader);
//define the images variable as an xml as the php file result
myRequest.data = images;
//outputting the filenames
function onLoaded(evt:Event):void {
trace("here we get the data back: "+myLoader.data);
//when the data is loaded, begin myRequest
myLoader.addEventListener(Event.COMPLETE, onLoaded);
myLoader.load(myRequest);
//array to call the images
var imageArray:Array //= NewArray();
var listLength:Number;
var il:XMLList = images.data //xml.images;
listLength=il.length();
var i:Number
var photo_btn:Array = new Array();
for (i = 0; i < listLength; i++); {
imageArray[i] = il[i].pic //xml.images[i].pic;
if (photo_btn[i].mouseDown == true) {
img_loader.load(imageArray[i])
if (i == 0) {
photo_btn[i].y = 422.7;
photo_btn[i].x = 411.5
else if (i > 0 && i < 24); {
photo_btn[i].y = 422.7;
photo_btn[i].x = (photo_btn[i-1].x + 18.6);
if (i > 24 && i < listLength); {
photo_btn[i].y = 442.7;
photo_btn[i].x = (photo_btn[i-1].x + 18.6);
img_loader.load(imageArray[0]);As for AS3 part of it, I am not sure your code really works. There are syntax and logical errors there.
I think you need to take it step by step and accomplish several task in the following sequences:
1. Write code that loads XML correctly;
2. Write code that enables buttons;
3. Write code that will load images on button clicks.
The code below shows in principal what needs to be done in order to load XML and make the data in this XML available for further consumption. Also, by accomplishing this step you will iron out all the PHP vs Flash wrinkles including your XML.
Please note, I don't know your XML structure so all the parsing issues you need to resolve yourself.
Once you get handle on it - we, hopefully, will talk about steps 2 and 3.
import flash.display.Loader;
import flash.events.*;
import flash.net.*;
var images:XML;
var myRequest:URLRequest;
var myLoader:URLLoader;
// list of image urls that will come from loaded XML
var imageList:XMLList;
myRequest = new URLRequest("Photography.php");
myLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, onFileLoaded);
// suggested handler for unexpected errors - avoids some headaches
myLoader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
myLoader.load(myRequest);
// Note: all the listeners are removed
// it is always wise to remove listeners that are needed any longer
// to make objects eligible for arbage collection
function onLoadError(e:IOErrorEvent):void
trace(e.toString());
myLoader.removeEventListener(Event.COMPLETE, onFileLoaded);
myLoader.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
function onFileLoaded(e:Event):void
myLoader.removeEventListener(Event.COMPLETE, onFileLoaded);
myLoader.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
images = new XML(myLoader.data);
// only now xml is ready and you can start loading images
imageList= images.pic; -
Hi everyone,
I just installed SP09 and i was testing the solution. And I found a problem with the approvals tasks.
I configured a simple ROLE approval task for validate add event. And when the runtime executes the task, the dispatcher log shows a error:
ERROR: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'
And the notifications configured on approval task does not start either.
The approval goes to the ToDO tab of the approver, but when approved, also the ROLE stays in "Pending" State.
I downgraded the Runtime components to SP08 to test, and the approvals tasks works correctly.
Has anyone passed trough this situation in SP09?
I think there is an issue with the runtime components delivered with this initial package of SP09.
Suggestions?Hi Kelvin,2016081
The issue is caused by a program error in the Dispatcher component. A fix will be provided in Identity Management SP9 Patch 2 for the Runtime component. I expect the patch will be delivered within a week or two.
For more info about the issue and the patch please refer to SAPNote 2016081.
@Michael Penn - I might be able to assist if you provide the ticket number
Cheers,
Kristiyan
IdM Development -
Web Services with ColdFusion and PHP mixed
Hi,
We need to used web services provided by remote server. The
problem is the
remote server is on PHP and our server is on ColdFusion. Is
there a way to
use the web services on PHP server with our ColdFusion
server?
I understand ColdFusion automatically generate the WSDL by
adding ?wsdl
after the CFC, but I can't do the same thing because the
remote server is
not on ColdFusion. They have given us the wsdl web address,
but it seems
using the wsdl address directly without CFC is not working.
Is that right?
Please let me know.
YCFrom the coldfusion side of things, it all seems okay what
you are doing. It
is an issue with the php/wsdl side of things. I can access
the wsdl ok, but
got the same error as PaulH just then when I tried to use web
service in
cf..
"YC" <[email protected]> wrote in message
news:[email protected]...
> OK, I learned a good thing. I tired the Dreamweaver +
icon with a
> ColdFusion CFC file and it works fine. Now I learned I
don't have to code
> the <cfinvoke> tag, but just drag and drop. But
when I tried the WSDL
file:
>
http://cyfernet.ces.ncsu.edu/ws/resources.wsdl,
and "ColdFusion MX" as the
> proxy generator, I had an error. Do I need any other
option to choose
from?
> It seems "Edit Proxy Generator list" doesn't provide a
sufficient answer.
>
> I know the URL of the WSDL file is correct because I
used it to create a
web
> service in PHP locally on my laptop, and it works. From
the previous
> answers of you and PaulH, it seems if the WSDL works
with PHP, it should
> also work with any other language, right?
>
> Have you tried yourself? Did it work?
>
> YC
>
> "Eric" <[email protected]> wrote in message
> news:[email protected]...
> >
> >
> > An easy way to do this is to use the dreaweaver
'components' palette.
> > Select
> > 'web services' from the drop down list and then
click the '+' icon to
> > create
> > the call to the web service. (this uses the
cfinvoke tag)
> >
> >
> > "YC" <[email protected]> wrote in message
> > news:[email protected]...
> >> I feel very sorry to keep asking this
apparently very basic question,
but
> >> please be patient with me.
> >>
> >> Yes, it is right that I just need to consume
the pre-existing web
> >> service.
> >> This is the WSDL page:
http://cyfernet.ces.ncsu.edu/ws/resources.wsdl
and
> >> this is the web service page on the server
using it:
> >>
http://cyfernet.ces.ncsu.edu/ws/getresources-client.php,
provided as an
> >> example.
> >>
> >> So in order to have the page run in ColdFusion,
at least the following
> >> tag
> >> below should come up without an error?
> >> <cfset
> >>
> >
ws=createObject("webservice","
http://cyfernet.ces.ncsu.edu/ws/getresources-c
> > lient.php")>
> >>
> >> Sorry, but I still get an error message.
> >> I need to provide "getResourcesByCatid" as the
method and "catid" as
the
> >> parameter, but it should work only if the
previous tag works without an
> >> error, right?
> >>
> >> YC
> >>
> >>
> >> "Eric" <[email protected]> wrote in
message
> >> news:[email protected]...
> >> >>>We need to used web services
provided by remote server.
> >> >
> >> > Right, so the web service already exists -
you just want to consume
it?
> >> >
> >> >>Is there a
> >> >> >> way to use the web services
on PHP server with our ColdFusion
> > server?
> >> >
> >> > Yes - thats the whole point of web
services, you can create them in
one
> >> > language/platform and consume them in
another.
> >> >
> >> >> Whey you say "create a web service,"
do you mean I need to create a
> >> >> <cfcomponent> tag in CFC format?
Creating a CFC is not a problem,
but
> >> >> how
> >> >> can I place it on the remote server
because it is running with PHP,
> >> >> not
> >> > with
> >> >> ColdFusion?
> >> >
> >> > Sorry if I am not understanding the
question clearly, but it seems to
> >> > me
> >> > that you want to make use of an existing
php based web service. Why
do
> > you
> >> > you need to place a CFC on the php server?
You just need to execute
the
> >> > web
> >> > service from the coldfusion server using
cfml. As Paulh says:
> >> >
> >> > <cfset
ws=createObject("webservice","url to the php based web service
> >> > here")>
> >> >
> >> > The variable 'ws' being your hook into the
php web service from
within
> >> > your
> >> > cfml code.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > "YC" <[email protected]> wrote in
message
> >> > news:[email protected]...
> >> >> Eric,
> >> >> Whey you say "create a web service,"
do you mean I need to create a
> >> >> <cfcomponent> tag in CFC format?
Creating a CFC is not a problem,
but
> >> >> how
> >> >> can I place it on the remote server
because it is running with PHP,
> >> >> not
> >> > with
> >> >> ColdFusion?
> >> >>
> >> >> YC
> >> >>
> >> >> "Eric" <[email protected]>
wrote in message
> >> >>
news:[email protected]...
> >> >> > >We need to used web services
provided by remote server. The
> >> >> > >problem
> >> >> > >is
> >> >> > >the
> >> >> > remote server is on PHP and our
server is on ColdFusion.
> >> >> >
> >> >> > Thats one of the main nenefits of
web services - this does not
> > matter.
> >> >> >
> >> >> >>> I understand ColdFusion
automatically generate the WSDL by
adding
> >> > ?wsdl
> >> >> >> after the CFC, but I can't do
the same thing because the remote
> > server
> >> > is
> >> >> >> not on ColdFusion.
> >> >> >
> >> >> > Sounds like you want to consume a
web service, not create one. You
> > can
> >> >> > create the call in Dreamweaver,
just look up help on calling a web
> >> >> > service. Also see Adobe site
using search for 'using web services
in
> >> >> > coldfusion'
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > "YC" <[email protected]>
wrote in message
> >> >> >
news:[email protected]...
> >> >> >> Hi,
> >> >> >> We need to used web services
provided by remote server. The
> >> >> >> problem
> >> >> >> is
> >> >> >> the remote server is on PHP
and our server is on ColdFusion. Is
> > there
> >> > a
> >> >> >> way to use the web services
on PHP server with our ColdFusion
> > server?
> >> >> >>
> >> >> >> I understand ColdFusion
automatically generate the WSDL by adding
> >> >> >> ?wsdl
> >> >> >> after the CFC, but I can't do
the same thing because the remote
> > server
> >> > is
> >> >> >> not on ColdFusion. They have
given us the wsdl web address, but
it
> >> > seems
> >> >> >> using the wsdl address
directly without CFC is not working. Is
> >> >> >> that
> >> >> >> right?
> >> >> >>
> >> >> >> Please let me know.
> >> >> >>
> >> >> >> YC
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
> -
I am looking for a solution to a problem I am having with an
XSL stylesheet and trying to use a php variable. The page I am
working on is a page to display some information based on the
graduation year of a class (I work at a school). For example last
years graduating class of 2006.
I have a statement in the XSL sheet that limits the shown
data to only that class year
<xsl:for-each
select="school[class_of='2006']">
I would like to replace that 2006 above with a php statment
such as $classyear since on that page the data is to display the
variable is already present, but I cannot get it to work. I have
tried to place php in the XSL and also to change the extention etc
and they all produce errors. I am assuming that XSL just can't use
variables in it?
Any help would be greatly appreciated. I would hate to have
to duplicate that one XSL sheet for every class year.
thanks
chrisDavid,
thank you so much so far for you help, it does sounds like we
are talking about the same thing. I think I am getting close.
I do want to pass the value when the XSL sheet is embedded.
I tried that and it seemed to not work, says the variable is
not found (I am using the dreamweaver built in transform).
I am just getting into the more complex XML stuff so I
apologize for my lack of knowledege.
I have pasted some of the code below, any idea what I am
doing wrong?
the page where it is embedded is
http://www.nmhschool.org/news/test11.php
php doc with the embed and include
<?php
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML("test11.xml");
$mm_xsl->setXSL("test11.xsl");
$mm_xsl->addParameter("yearXX", "2006");
echo $mm_xsl->Transform();
?>
http://www.nmhschool.org/news/test11.xsl
is the XSL
<xsl:for-each
select="Report/GroupHeader2/GroupHeader2_1[q1.CnPrAl_Class_of =
$yearXX]">
<table width="100%" border="1" cellspacing="1"
cellpadding="1">
<tr> blah blah blah........
http://www.nmhschool.org/news/test11.xml
is the XML data -
Calculate a php class with a new variable
I am not sure what a class is. i have a page already written that has classes in place for equations. I have made some new variables for some new equation but am getting incorrect results, I basically need to multiple / divide / subtract these prebuilt classes against my new variable
this is what i have so far
<?php
$utilityHost = 21.0;
$col4 = $option_two->amount_due_before - $option_two->four_weeks_security - $option_two->fee;
$col5 = $col4 / $row_Recordset1['rental_price'];
$col3 = $utilityHost * $col5;
$col6 = $row_Recordset1['rental_price'] * $col5;
?>
$col4 is the variable using the pre built classes.
all of these are being echoed out into a table
e.g
<?php
echo "£" . number_format($row_Recordset1['rental_price'] - $utilityHost);
?>
<?php
echo "£" . $utilityHost;
?>
the classes
<?php
require_once('../lib/PaymentOptionOne.php');
require_once('../lib/PaymentOptionTwo.php');
require_once('../lib/PaymentOptionThree.php');
require_once('../lib/PaymentOptionFour.php');
$rent = $row_Recordset1['rental_price'];
if($row_Recordset1['weekly_rate'] != 0.00)
$rent = $row_Recordset1['weekly_rate'];
$weeks = $row_Recordset1['weeks'] / 7;
$query = "SELECT * FROM editprop WHERE prop_id = %s";
$query = sprintf($query, GetSQLValueString($row_Recordset1['prop_id'], "text"));
$results = mysql_query($query);
while($row = mysql_fetch_array($results))
$option_three_rent = $row['rental_price_monthly'];
if(empty($option_three_rent))
$option_three_rent = $rent;
$option_one = new PaymentOptionOne($rent, $weeks);
$option_two = new PaymentOptionTwo($rent, $weeks);
$option_three = new PaymentOptionThree($option_three_rent, $weeks);
thanks in advance>multiple my variable with the classes that are already in place
Classes are complex constructs that hold data structures and methods. You don't multiple a variable with a class - you can reference a variable within that class or object. What exactly is the problem you are having with this?
This syntax should work (note that I'm just using arbitrary variables:
$col4 = $option_two->amount_due_before * $col2
I think it is critical that you become familiar with object oriented coding if you are going to be working with it.
http://www.elated.com/articles/object-oriented-php-for-absolute-beginners/
Maybe you are looking for
-
My iRadio does not work on my macbook pro
my iRadio works on my iphone but not my macbook pro
-
In DVD Player, What is Error -36 and how do I fix it?
I bought a new superdrive dvd player/burner (for DVD -R, -RW) and installed it in my Pismo. Reason I got it, I was having trouble viewing DVDs I'd compressed from a regular commercial DVD to 4.5GB DVD -Rs using the application DVD2oneX2. They play fi
-
My ipod nano 6th gen doesn't start. When I plug it, only blink the apple logo on the screen. I try to reset it holding by 8 seconds start button and volume down and doesn't work. My Ipod doesn't have any shock or water damage. How can I do?
-
Using system keycodes instead of JAVA virtual keycodes
I want to implement a key scramble and I need a method to read the system key codes instead of the virtual keys produced by KeyEvent and its methods.Does anybody knows how can this be done?
-
Keeping a connection with HDMI thunderbolt and HD TV what settings in Preferences are needed?