Solved

asFunctios and linking using PHP

Posted on 2002-04-09
2
202 Views
Last Modified: 2010-04-03
Hi everyone

What I am trying to do is create a news page. The page has a lead story and  a list of headlines. I have built the site using php and it all works fine. You click on the link and it takes you to a "detailed" page were you can read the full story.

The tricky bit is that I want it to work in flash.

I have managed to get the variable to load into flash using

loadVariables ("alpha_news.php", "_root");

and it loads the varibles that I have stated in my PHP doc.

<?php echo "&title=".$alphaNews->Fields("storyTitle")?>
<?php echo "&author=".$alphaNews->Fields("storyAuthor")?>
?php echo "&summary=".$alphaNews->Fields("storySummary")?>

What I need to know is how do I get this <?php echo "&title=".$alphaNews->Fields("storyTitle")?> variable to be a link and display in flash?

I would also like to know how, when the user clicks that link (in flash) they are taken to the next frame (in flash) were the details of that news article are displayed.

I think its something to do with "asfunction" but unfortunatly I'm not that advanced yet.  
0
Comment
Question by:DennisMcDougall
2 Comments
 
LVL 2

Accepted Solution

by:
mousefist earned 300 total points
ID: 6935060
all you need is a dynamic text field, or 3 of them i suppose.  if you want to keep it simple, put the text fields on the same timeline as the loadvariables, but it would be cleaner to put the loadvariables action in a movie clips, and set the variables to match the variable in your text field (matching the variable names is the important part).  make sure you give enough time to retrieve the variable - make sure that the "title" var in flash has had time to get the title var from php before you have any code that uses the title var in flash.

the problem with clicking on a button that takes you to the next frame that contains the details is scope.  you'll have to fiddle with this a bit.  when you set a variable, it's instance has to be available to you ... and this is all a bit sensitive ... if the text box is farther down the timeline from where you retrieve the variable, and you want to go there later, it *probably* won't be there when you want it.  what you need is another movie clip, with your text boxes for the details ... and then name the instance "details".  then _root.details.summary is the path to the variable for the summary text box.  then put that movie clip on a layer that spans across to where your loadvariables action was.  you can set
_root.details._alpha = 0;
when you don't want to see them, and then
_root.details._alpha = 100;
when you do.  that should be enough to get you going,

m!
0
 

Author Comment

by:DennisMcDougall
ID: 6952640
Thats kind of what I was after and since your the only person on many forums to answer this you can have the points.

What I did in the end was create 10 templates and loaded separate variables into each one.

Then used an asfunction in my database the create the link in flash.

It seem so easy now!

Thanks

<?php


  //    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  require("../../../adodb/adodb.inc.php");
  require("../../../Connections/phpnews.php");
?><?php
   $rsAlphanews=$phpnews->Execute("SELECT * FROM alphafront ORDER BY ID ASC") or DIE($phpnews->ErrorMsg());
   $rsAlphanews_numRows=0;
   $rsAlphanews__totalRows=$rsAlphanews->RecordCount();
?><?php
   $rsheadlines=$phpnews->Execute("SELECT * FROM alphafront ORDER BY ID DESC") or DIE($phpnews->ErrorMsg());
   $rsheadlines_numRows=0;
   $rsheadlines__totalRows=$rsheadlines->RecordCount();
?><?php
   $Repeat1__numRows = 10;
   $Repeat1__index= 0;
   $rsheadlines_numRows = $rsheadlines_numRows + $Repeat1__numRows;
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>
  <?php echo "&title=".$rsAlphanews->Fields("storyTitle")?>
</p>
<p>
  <?php echo "&author=".$rsAlphanews->Fields("storyAuthor")?>
</p>
<p>
  <?php echo "&summary=".$rsAlphanews->Fields("storySummary")?>
</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<p>&nbsp; </p>
<p>
  <?php while (($Repeat1__numRows-- != 0) && (!$rsheadlines->EOF))
   {
?>
  <?php echo $rsheadlines->Fields("storyTitle")?><br>
  <?php
  $Repeat1__index++;
  $rsheadlines->MoveNext();
}
?>
</p>
</body>
</html>
<?php
  $rsAlphanews->Close();
?>
<?php
  $rsheadlines->Close();
?>
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question