?
Solved

asFunctios and linking using PHP

Posted on 2002-04-09
2
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
mousefist earned 1200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 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. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to record live broadcast.
Suggested Courses

765 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