• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

image in dynamic textfield

hi,

- i want to load some simple html into a dynamic text-field

- this is the html:
<p>test<p><p><img src='http://www.de-tuinarchitecten.be/uploads/big.jpg'></p><p>blaaat</p>

- i've used php to get it out of a database and i've passed it to flash using <param name=FlashVars value="content=<?php echo $content ?>"> and <embed FlashVars="content=<? echo $content ?>" src="index.swf" [...]
(see source of page mentioned below)

- i've prepared a dynamic text-field with instance name content_txt which is multiline, "render text as html" is selected.

- action in the first frame contains:
this.content_txt.html = true;
this.content_txt.htmlText = _global.content;

everything works well, except the image isn't displayed... can anyone tell me why not?

you can see the result here (click on the "wie"-button, bottom-right):
http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136

the html above the flash is exactly what the same as what *should* be rendered in the swf.

thanks in advance.
0
Zorro032798
Asked:
Zorro032798
  • 30
  • 27
1 Solution
 
BillystyxCommented:
hsv you tried a relative path - I don't know if this is the answer but
<p>test<p><p><img src='http://www.de-tuinarchitecten.be/uploads/big.jpg'></p><p>blaaat</p>

maybe
<p>test<p><p><img src="uploads/big.jpg"></p><p>blaaat</p>

Billystyx
0
 
Zorro032798Author Commented:
thanks for yr reply

nope, doesn't change anything
i tried:
- <img src='uploads/big.jpg'>
- <img src='/uploads/big.jpg'>
- <img src='../uploads/big.jpg'>
- <img src='../../uploads/big.jpg'>

nothing works
:'(

with double quotes, the whole thing goes bananas, but that's probably because i used double quotes in the param and embed tags.

other ideas?
plz?
0
 
BillystyxCommented:
is your db pulling the name of the image only, or is it actually pulling the image?
IE, is the image stored in the db, or just the path?
Reason I ask is that I have heard there is issues with pulling blob images into flash directly - you may be better off storing the images in a folder on your root, and just storing the image names.

Billytsyx
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Zorro032798Author Commented:
it pulls the name
0
 
BillystyxCommented:
and in your fla does the name variable return correctly?
If you don't know this, use loadVariables from flash to the php page that pulls the image name and return the value that way  with print($your variablename);
I have a feeling that the way you called the flashVars doesn't work.
You may needa string for that
$myVar=$content;
and flashVars=$myVar, without the quotes.


Billystyx
0
 
Zorro032798Author Commented:
i'm a bit confused now...
do you mean i have to load the variable back to a php-page?

what would i have to put in the fla? and where?

thx for the reply
0
 
BillystyxCommented:
from inside flash you can call your php page that gets the picture name - using
loadVariables("yourphppage.php","","POST");
The idea is that once the page has processed stuff, you return, along with the necessary variables, a final success variables, so that flash knows it can move onto the frame that uses the returned variables.
All variables must be returned in name value pairs, like
(this is from php) $myVars="&picName=".$yourpicvariable."&success=1&";
print($myVars);

then in flash
loadVariables("yourphppage.php","","POST");
gotoAndPlay("loading");
and on loading frame1:
if(success=="1"){
gotoAndPlay("picframes");
}
and on loading frame2 (separate key frame)
gotoAndPlay("loading");

obviously you need frame labels for this method, but it is quite straight forward.
Another alternative is using the loadVar class which does a lot of this (flash side stuff) for you.
let me know how you go, or if it still doesn't make sense.
Billystyx
0
 
Zorro032798Author Commented:
okay, i don't quite think that that's necessary just yet (maybe in a later stadium, thanks for the tip)

i first want to get the picture displayed in the flash;
i have this actionscript in the first frame:
/*
this.content_txt.html = true;
this.content_txt.htmlText = "<p>test httrhtrhtrhrthtr</p><p></p><p><img src='/uploads/big.jpg'></p><p>blaaat</p>";
*/
the text ("test httrhtrhtrhrthtr" and "blaaat") is displayed correctly (in paragraphs), the image isn't...
0
 
BillystyxCommented:
In relation to the html file holding the main swf, where is the picture?
Like, the html file is in the root directory and the picture is in upload directory which is in the root directory?

Billystyx
0
 
Zorro032798Author Commented:
the setup is this:

http://www.site.dom/
http://www.site.dom/modules/pages/ -> page/data-handling scripts
http://www.site.dom/templates/ -> html-template that calls the swf (which resides in the same directory)
http://www.site.dom/uploads/ -> image that i want displayed


hope this helps
thx
0
 
BillystyxCommented:
../uploads/image should work then.
do a plain html file and put the src tag into it, saving the html file into the templates folder.
Does that work?
or, check this is the case, the variable name of your html enabled field looks like this (more or less)
myVar="<img src='../uploads/big.jpg'>";

Billystyx
0
 
Zorro032798Author Commented:
yes, this is all fine
i refer to my first post (http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136)

piece of html that comes before the flash is te same variable, this renders "<p>test</p><p></p><p><img src='/uploads/big.jpg'></p><p>blaaat</p>"

so i presume the problem is mos def in the swf
0
 
BillystyxCommented:
In the swf, does your code look like this:
myVar="<img src='../uploads/big.jpg'>";

ie, do you have the variable name= and double quotes, with single quotes inside etc?

Can you post the actual code in you your swf referring to the src.
In the meantime, download the file (a fla) from here
http://www.billystyx.co.uk/setups/fla10.zip

it may provide some clues.

Billystyx
0
 
Zorro032798Author Commented:
i appreciate that you're stickin around, hehe

but i think i'm losing it, aargh
check this:
http://de-tuinarchitecten.be/templates/html.html
(http://de-tuinarchitecten.be/templates/html.swf)
i started over with something supersimple, and it works, thx for the tips

however, i tried to get it to work in the files i was given;
http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136 (click on 'wie' , right bottom)
(http://www.de-tuinarchitecten.be/modules/motionmill/wie.swf)
i did exactly the same! the text displays, the image still doesn't

in the flash-file (wie.swf, which:
loadVariables ("data.php", "_root", "POST");
cnt.htmlText = content;
stop();

data.php file: <?php echo '&content=blaaaaaaaaat<img src="http://de-tuinarchitecten.be/templates/big.jpg">'; ?>



i was thinking, does it maybe have something to do with scenes? do they have to be included in the path?
i'm lost...
0
 
BillystyxCommented:
in your php file, make sure you send back a success variable as last thing -
$success="&success=1&";
print($success);
after your loadVariables, try
gotoAndPlay("loop";//add 3 keyframes next to each other
//first frame label 'loop'
on 1st of those 3 frames put
if(_root.success=="1"){
gotoAndStop("frameafterthenextone");//and put a framelabel matching on the 3rd
// frame there.
}
then, on frame2 of those loop frames:
gotoAndPlay("loop");
then on frame 3:
createTextField("txt1",10);
txt1.htmlText=true;
txt1.Text=_root.content;//I am guessing content is the html string from the php
//page

Does this work?

Billystyx
0
 
Zorro032798Author Commented:
:(

i did exactly what you said...
it doesn't get to the "successframe", stuck on "loop"-frame

http://de-tuinarchitecten.be/modules/motionmill/index.php?iid=136

php: http://de-tuinarchitecten.be/modules/motionmill/data.php

so this means the variable isn't passed? was i right to just append the success-variable like so:?
<?php
  $vars = '&content=blaaaaaaaaat<img src="/uploads/big.jpg">&success=1&';
  echo $vars;
?>
0
 
BillystyxCommented:
not quite...

<?php

  $vars = "&content=blaaaaaaaaat<img src='/uploads/big.jpg'>&success=1&";
  echo $vars;
?>
should work.


billystyx
0
 
BillystyxCommented:
if this does not work, test the swf, goto debug->variables and look for success (click in the debug window, ctl-f to find and search on 'success'.
what is the full reference to it, if its there?
also look for content, what does it show in that window?
I have a feeling there are special circumstances in php for / and \ symbols in variables, but I can't remember them..
Billystyx
0
 
BillystyxCommented:
try this in the php...

$vars = "&content=blaaaaaaaaat<img src=\'/uploads/big.jpg\'>&success=1&";//the backslash shows the ' as part of the string, as it should do - without it, you don't get that, and flash wouldn't interpret it properly.

Billystyx


0
 
Zorro032798Author Commented:
this is the output
note i do not have a local server, i test remote. but i guess the variable is there, right?
----
Level #0:
Variable _level0.$version = "WIN 7,0,19,0"
Variable _level0.<?php

  $vars  = " \""
Variable _level0.content = "blaaaaaaaaat<img src=\\'/uploads/big.jpg\\'>"
Variable _level0.success = "1"
Variable _level0.";

  echo $vars;

?> =
----
is _level0 the same as _root?

i changed data.php, both switch of quotes and escaping the quotes didn't change anything...
0
 
Zorro032798Author Commented:
http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136

i called the variable success in the "loop" frame

:? :?
0
 
Zorro032798Author Commented:
ps:
success_fld.text = _root.success;
if(_root.success=="1"){
gotoAndStop("successframe");
0
 
BillystyxCommented:
now we are getting somewhere!

this should work already (kind of) but try this, change this bit in flash

if(_root.success=="1"){
gotoAndStop("frameafterthenextone");//and put a framelabel matching on the 3rd
// frame there.
}

to
if(_level0.success=="1"){
gotoAndStop("frameafterthenextone");//and put a framelabel matching on the 3rd
// frame there.
}

Did you change the php file already? If so, it doesn't look right for the content, see how it is now..

Variable _level0.content = "blaaaaaaaaat<img src=\\'/uploads/big.jpg\\'>"

with double backslashes either side of the filepath.

change the file back to original, like this...


<?php

  $vars = "&content=blaaaaaaaaat<img src='/uploads/big.jpg'>&success=1&";
  print($vars);
?>

and try it again.

Billystyx

0
 
BillystyxCommented:
whats the output look like without the quotes escaped and with (what's the difference between the 2?)
0
 
Zorro032798Author Commented:
nothing changed by changing the variable-path (so i guess _level0 == _root ?)

filepath is okay now; Variable _level0.content = "blaaaaaaaaat<img src='/uploads/big.jpg'>"
0
 
BillystyxCommented:
well if both vars are good is it working?
make sure the textfield is set to render html.
Billystyx
0
 
Zorro032798Author Commented:
it's not working
it still doesn't go to the 'successframe'...;

http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136 
it's stuck on 'loop'-frame, actions on that frame:
success_fld.text = _root.success;
if(_root.success=="1"){
gotoAndStop("successframe");
}

success_fld is a dynamic text-field located behind "success="

0
 
BillystyxCommented:
just to check all this through again -
(pretend its a new flash doc)
frame1:
loadVariables("yourphppage.php","","POST");
gotoAndPlay("loading");

frame2:
(label name 'loading')

if(_root.success=="1"){
gotoAndStop("successframe");
}
frame3:
gotoAndPlay("loading");
frame4:
(label name "successframe")
Textfield in place - render as html, variable name as
'content'

Billystyx

also, you could try loadVars:

c= new LoadVars();
c.onLoad = function(success)
{
gotoAndStop("successframe");    
};

c.sendAndLoad("http://www.fiberfilmfestival.com/sendemail.php", c, "POST");
     
};
stop();
all on first frame



0
 
Zorro032798Author Commented:
i started from scratch and did exactly what you said

current data.php:
<?php echo '&content=<p>image should appear beneath this line</p><p><img src="http://de-tuinarchitecten.be/uploads/thumb_big.jpg"></p><p>image should appear above this line</p>&success=1&'; ?>
(this is the same file i used on http://de-tuinarchitecten.be/templates/html.html -> i don't get it, here the image ís displayed, but the paragraphs are rendered wrong...)

so i'm through to the 'successframe' but the image still isn't loaded

i so checked everything over and over :(


0
 
BillystyxCommented:
So the image is loaded now - just in the wrong place?

Billystyx
0
 
BillystyxCommented:
If not, can you send me the fla and the address (absolute) of the php file.
BTW, in the 2nd previous post of mine, I copied a loadVars example from another question - hence the strange address there.

Billystyx
0
 
Zorro032798Author Commented:
the image is loaded in a very simple testfile i made

when i use the files that were given to me by the designer, it fails
i'll send you the fla (thx for lookin at it)

the php file resides here: http://www.de-tuinarchitecten.be/modules/motionmill/data.php
0
 
BillystyxCommented:
great - I will check it out this evening:)

billystyx
0
 
BillystyxCommented:
I should have noticed before, but content is a reserved word.
Change in your php file to content1, and also in flash.
Can you do that soon?
Then I can still help

billystyx
0
 
BillystyxCommented:
I have the text showing now - not image, here is what s in debug:

Variable _level0.content = "<p>image should appear beneath this line</p><p><img src=\"http://de-tuinarchitecten.be/uploads/thumb_big.jpg\"></p><p>image should appear above this line</p>"

do in php like this:
content = "image should appear beneath this line<img src='../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/>image should appear above this line";

billystyx


0
 
Zorro032798Author Commented:
i so appreciate your help, but i'm swamped in work right now
i will check it out as soon as i can, prolly next week though

plz don't be mad, hehe
0
 
BillystyxCommented:
No worries, just post here when you have checked it out, so I am reminded about it:)
0
 
Zorro032798Author Commented:
still no image....

php-file looks like this now:
&content_var=image should appear beneath this line<img src='../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/>image should appear above this line&success=1

(without <?php ?>)


i changed content to content_var and changed the instance name of the dynamic textfield in content_txt
( content_txt.htmltext = content_var;)

result: http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136

0
 
BillystyxCommented:
so php looks like
<?php
$myVar="&content_var=image should appear beneath this line<img src='../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/>image should appear above this line&success=1&";
print($myVar);
?>

If so, I will try my own version at home tonight and see what's going wrong.

Bear with me...

Billystyx
0
 
Zorro032798Author Commented:
well, i just put this line in the php-file, to rule out any problems;

&content_var=image should appear beneath this line<img src='../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/>image should appear above this line&success=1

i guess it's the same as
<?php
$myVar="&content_var=image should appear beneath this line<img src='../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/>image should appear above this line&success=1&";
print($myVar);
?>

but i wanted to be sure that wasn't the problem...
0
 
BillystyxCommented:
OK, I will check it tonight, do my own php file and image etc and see if I can figure out where the problem is.

billystyx
0
 
Zorro032798Author Commented:
note: the path was wrong in the php-file, should be:

<?php
$myVar="&content_var=image should appear beneath this line<img src='../../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/>image should appear above this line&success=1&";
print($myVar);
?>
0
 
Zorro032798Author Commented:
... but that didn't fix it though
0
 
BillystyxCommented:
I will do it tonight and let you know.

Did you change the variable name content_var in your swf?
Have you tried adding the html string directly into a textfield in flash rendered as html?

billystyx
0
 
Zorro032798Author Commented:
yes, i changed the variable name (in properties of the dynamic textfield you mean, right? if so, yes)

at this moment the actioncript for the successframe is:
//content_txt.htmltext = content_var;
content_txt.htmltext = "<p>image should appear beneath this line</p><img src='../../uploads/thumb_big.jpg' align='right' hspace='15' vspace='10' width='100' height='100'/><p>image should appear above this line *sigh*</p>";
stop();

result:
http://www.de-tuinarchitecten.be/modules/motionmill/index.php?iid=136
0
 
Zorro032798Author Commented:
(didn't work with the absolute path to the image either)
0
 
BillystyxCommented:
I just want to go through this folder thing again - because I am almost certain that is the issue.
I will make up the folder names here, just sub the real ones for mine and let me know if it matches.

OK, the swf is embedded in an html doc. The html doc is in folderA. If you go up out of folderA you find yourself in folderB. If you go up out of folder B you find yourself in folderC. In folder C is a folder called 'uploads'. The jpg is directly in that folder called 'uploads'.

Billystyx
0
 
Zorro032798Author Commented:
directory structure is as follows:

http://www.de-tuinarchitecten.be/ -> siteroot
http://www.de-tuinarchitecten.be/modules/motionmill/ -> page/data-handling scripts, that call the template
http://www.de-tuinarchitecten.be/templates/ -> html-template that calls the swf
http://www.de-tuinarchitecten.be/uploads/ -> where the image is that i want displayed

the swf resides in the /modules/motionmill/-directory (please disregard earlier post in this thread about structure...)
0
 
Zorro032798Author Commented:
if it's useful, here's the template-content:
<!--url's used in the movie-->
<!--text used in the movie-->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="100%" id="modules/motionmill/index" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="index.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="index.swf" quality="high" scale="exactfit" bgcolor="#ffffff" width="100%" height="100%" name="index" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

(they really should make your previous posts editable... hehe, i always want to add stuff mater :s)
0
 
Zorro032798Author Commented:
or correct errors... like 'mater'->later

lol
0
 
BillystyxCommented:
so the relative path would be ../uploads/thumb_big.jpg

not
../../uploads etc
billystyx
0
 
Zorro032798Author Commented:
no, because the template is included in a script, which resides in the /modules/motionmill/ directory
therefore it needs to jump two levels

right?
0
 
BillystyxCommented:
I am fairly sure it doesn't work like that, but I have an example of that at home too that works - so I will check it out and let you know.
(like a php page with an include statement)

billystyx
0
 
BillystyxCommented:
seems to be a problem with the fla - I have tried using a static variable inside the swf to the same folder (didn't work), and I tried a new fla with everything the same (minus the rest of your movie), and it worked...
I am looking into it..
0
 
BillystyxCommented:
found the problem - your publish settings were for flash player 6 (which won't support img tags) not 7 (which will)

Let me know how you go!

billystyx
0
 
Zorro032798Author Commented:
yes!!
i knew it was something stupid.... hehe

thanks so much for sticking with me :)
0
 
BillystyxCommented:
no worries:)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 30
  • 27
Tackle projects and never again get stuck behind a technical roadblock.
Join Now