Solved

asFunctios and linking using PHP

Posted on 2002-04-09
2
172 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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now