all groups > flash actionscript > december 2004 >
You're in the

flash actionscript

group:

Help! Loading HTML from HTML


Help! Loading HTML from HTML msngLinkCO
12/29/2004 9:43:23 PM
flash actionscript:
Can anyone help?

In HTML I have:

<link href="../html_styles.css" rel="stylesheet" type="text/css">
<body>
<p class="headline">Frequently Asked Questions</p>
<p>
01. <a href="asfunction:answer,text/faqAnswer01.html">First question?</a>
02. <a href="asfunction:answer,text/faqAnswer02.html">Second question?</a>
<!-- etc. -->
</p>
<body>

In Flash I have:

content_txt.autosize = true;

var ss:TextField.StyleSheet = new TextField.StyleSheet();
ss.load("html_styles.css");
content_txt.styleSheet = ss;

content_txt.multiline= true;
content_txt.wordWrap = true;
content_txt.html = true;

story = new XML();
story.ignoreWhite = true;
story.load("text/faqQuestions.html");
story.onLoad = function () {
content_txt.htmlText = story;
}

This loads my external "faqQuestion.html" file just fine. I'd like to use the
"asfunction" to populate a dynamic text field "answers_txt" upon clicking any
question in my loaded "faqQuestions.html" file.

Here's what I've tried:

function answer(href) {
this._parent.gotoAndPlay("c02");
load(href,this._parent.answer_txt);
}

This correctly sends the play-head to the location of my "answers_txt" field
but doesn't load the appropriate answer. Or anything for that matter.

What am I doing wrong?
Re: Help! Loading HTML from HTML Peter Blumenthal
12/30/2004 12:20:59 PM
Try:

function answer(href) {
this._parent.gotoAndPlay("c02");
this._parent.answer_txt.load(href);
}

You might also want to trace the value of href, to make sure it is what you
expect.

Re: Help! Loading HTML from HTML msngLinkCO
12/30/2004 6:14:59 PM
I guess even a newB should be able to trace. My AS skills a limited and I'm
typically fumbling my way through.

What you gave me makes sense but without tracing the value of href all I can
say is this didn't fix the problem and when I test I get "Error opening URL
"file://undefined"
Re: Help! Loading HTML from HTML Peter Blumenthal
1/4/2005 12:47:45 PM
You can trace the value of the parameter being passed into your function
like this:

function answer(href) {
trace ("href = "+href);
this._parent.gotoAndPlay("c02");
this._parent.answer_txt.load(href);
}

Re: Help! Loading HTML from HTML msngLinkCO
1/4/2005 4:44:33 PM
Thanks for your help.

When I click on "First question?" the trace outputs:

href = text/faqAnswer01.html
Error opening URL
Re: Help! Loading HTML from HTML Peter Blumenthal
1/5/2005 4:29:23 PM

[quoted text, click to view]

2 further questions:

1 - what is ' this._parent.answer_txt' - is it an XML object instance?

2 - Are you trying to access a file called 'faqAnswer01.html' in a sub
folder, 'text', of the folder where your movie resides?


AddThis Social Bookmark Button