Solved

asFunctios and linking using PHP

Posted on 2002-04-09
2
183 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flash doesn't load in Iphone and Ipad 22 481
Accessing Live Dynamic Stream 6 190
Advertising design for my own Purpose 5 73
Install adobe flash plugin for Firefox win 7 9 68
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

932 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

11 Experts available now in Live!

Get 1:1 Help Now