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

Reading of a dynamic html page with AS3 possible?

New Here ,
Jun 04, 2013 Jun 04, 2013

Hi,

I have a short question, I have this html page which contains a chat, the chat is built out of html. Thats one chatline:

<li class="chat_from_duplin line" data-sender="duplin">

<p><span class="small">10:39 </span>

<a class="mod_button timeout" title="Timeout duplin"><img alt="Timeout" src="http://www-cdn.jtvnw.net/images/xarth/g/g18_clock-00000080.png"></a>

<a class="mod_button ban" title="Ban duplin"><img alt="Ban" src="http://www-cdn.jtvnw.net/images/xarth/g/g18_ban-00000080.png"></a>

<a class="mod_button unban" style="display:none;" title="Unban duplin"><img alt="Unban" src="http://www-cdn.jtvnw.net/images/xarth/g/g18_unban-00000080.png"></a>

<a class="nick" href="/duplin" id="chat-line-883893694" style="color:#FF4500">duplin</a>:

<span class="chat_line">There should be a ravage Icon, do you know if she is planning to do any suscriber icons?</span></p>

</li>

So, would it be possible to have a standalone swf file opened with Flash to read this content? Considering the chat is scrolling, and only a part of the chat is visible in the html of the page.

Regards

TOPICS
ActionScript
1.3K
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

correct answers 1 Correct answer

Community Expert , Jun 05, 2013 Jun 05, 2013

you don't need javascript if you just want to "read" the html code. 

reading the html code in flash isn't difficult.  you can use the urlloader class to load an html page.

the hard part is displaying what is encoded in the html page.  you'd have to manually parse the html code (using the flash string/array methods) and take the appropriate steps to desplay the content encoded in the html page.

Translate
Community Expert ,
Jun 04, 2013 Jun 04, 2013

possibly with an air app.  otherwise, no.

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
New Here ,
Jun 05, 2013 Jun 05, 2013

Could you please explain a little bit more, why it is not possible and why it is maybe possible with Air?

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
Community Expert ,
Jun 05, 2013 Jun 05, 2013

an air app can use the htmlloader class or stagewebview and one of those is needed to load and display general html pages.  otherwise, flash has a very limited ability to handle html tags.

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
New Here ,
Jun 05, 2013 Jun 05, 2013

Ah, ok thanks for the explanation, another question then, JavaScript is able to read html pages right, and AS3 is capable of calling JavaScript functions with the ExternalInterface, so that might be a solution then?

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
Community Expert ,
Jun 05, 2013 Jun 05, 2013

you don't need javascript if you just want to "read" the html code. 

reading the html code in flash isn't difficult.  you can use the urlloader class to load an html page.

the hard part is displaying what is encoded in the html page.  you'd have to manually parse the html code (using the flash string/array methods) and take the appropriate steps to desplay the content encoded in the html page.

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
New Here ,
Jun 06, 2013 Jun 06, 2013

Ok, so it is possible, it is just hard to accomplish in Flash, and I just need the above part to be read. I will try and see if I can work it out thanks for your answer

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
Community Expert ,
Jun 06, 2013 Jun 06, 2013
LATEST

you're welcome.

it doesn't take much.  this will load an html file:

var urlL:URLLoader=new URLLoader();

urlL.addEventListener(Event.COMPLETE,completeF);

urlL.load(new URLRequest("http://www.adobe.com"));

function completeF(e:Event):void{

trace(e.target.data);

}

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