Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can dynamic text fields in the canvas be populated with data from an external text file?

Explorer ,
Jan 08, 2020 Jan 08, 2020

Scenario: A canvas has some dynamic textfields with instance names. I want these textfields to be populated by the data from a text file immediately, no clicking of buttons, just instantly appear once the page is opened. Said instances are: ToName, FromName, Greeting, and IntroMessage.

In my original flash site, a textfile is generated from a php (worked in flash, haven't gotten it going in canvas yet), but before I do even THAT, I want to know if the generated textfile's contents are in the correct format for use with the canvas.

The original e-card used this ActionScript to load the text file: 

loadVariablesNum ("http://www.mysite.net/dBText/"+EcardText+".txt", 0);

EcardText is a random number, the name of the text file, generated by the php, so I need to be able to get that same function in jQuery.

Recently, I was given this code format, don't know how to use it in place of the old code:

$.load()


The contents of the textfile are as follows:

ToName=JohnDoe&ToEmail=Person@makebelievesite.com&FromName=FriendlyPerson&FromEmail=ecards@mysite.net&Greeting=hi&IntroMessage=Hello John&Created=&

 

This php (not the same one that generated the text), is the one that tells the text file to put its contents into the dynamic textfields. Instead of embedding an swf onto it, I embed the canvas this time. Since this isn't flash anymore, I don't know if I need to change anything here, so here it is:

<HTML>
<HEAD>

<TITLE>UNDISCLOSED</TITLE>

<?
register_globals( 'NGPCFRES' );

function register_global_array( $sg ) {
    Static $superGlobals    = array(
        'e' => '_ENV'       ,
        'g' => '_GET'       ,
        'p' => '_POST'      ,
        'c' => '_COOKIE'    ,
        'r' => '_REQUEST'   ,
        's' => '_SERVER'    ,
        'f' => '_FILES'     ,
        'n' => '_SESSION'
    );
    Global ${$superGlobals[$sg]};
    foreach( ${$superGlobals[$sg]} as $key => $val ) {
        $GLOBALS[$key]  = $val;
    }
}
function register_globals( $order = 'gpc' ) {
    $_SERVER;       //See Note Below
    $_ENV;
    $_REQUEST;
    $order  = str_split( strtolower( $order ) );
    array_map( 'register_global_array' , $order );
}

switch ($_GET['ENum']) {

## TEST Cards

	case '1':
	$goto = "ecards/birthdaycards/birthday1.html?EcardText=".$EcardText;
	$Dimensions = "WIDTH=700 HEIGHT=564";
	break;

}

?>

<?php

$url = 'http://www.mysite.net/images/wallpaper.png';

?>
    </script>
</head>

<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">
<br>
<br>
<br>
<br>
<center>
<OBJECT
 <? print "$Dimensions";?>>
 <PARAM NAME=movie VALUE="<? print "$goto";?>"> <EMBED src="<? print "$goto";?>" quality=high bgcolor=#FFFFFF  <? print "$Dimensions";?></EMBED>
</OBJECT>
</center>
<style type="text/css">
body
{
background-image:url('<?php echo $url ?>');
}
</style>
</BODY>
</HTML>


quick note, afraid my previous post might have been too big/overhwelming. so this is only asking a small piece at a time. thank you!!!

TOPICS
Code
514
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 09, 2020 Jan 09, 2020

The old Flash paradigm of having to pass data into a plugin doesn't exist anymore with Canvas documents. Any global JavaScript functions and data can be accessed directly by JavaScript in the Canvas document. Any external JavaScript on the page can directly control a Canvas document via the global variable exportRoot, which points to the Canvas root timeline. The only tricky part is waiting until both the Canvas and the page scripts have initialized before they try talking to each other.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2020 Jan 10, 2020

OK that makes some sense. So my php should be generating a js file, and then i should use the ajax or load function to load that js from within the e-card's timeline? (or is there a specific function?)

 

I'll try tinkering with it, and if I succeed, I'll post a new topic about getting my send button to work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2020 Jan 10, 2020
LATEST

"So my php should be generating a js file"

 

Uh... you do you, man.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines