View unanswered posts | View active topics



Reply to topic  [ 14 posts ] 
mx.TextArea object does not render/shows blank page 
Author Message
Member

Joined: Thu Jun 18, 2015 12:01 am
Posts: 6
Reply with quote
Hello,
I have just stared with FlashDevelop and ActiveScript and used the simple application template to create my first AS3 page. I try to render TextArea control from "mx" library. My code compiles and runs but FlashPlayer shows just blank page. It looks like the control is completely ignored. I get the same behavior in FireFox38 and IE11. Here is the fragment of my test-project code that does not produce any visual result :
Code:

private function init(e:Event = null):void
{
  removeEventListener(Event.ADDED_TO_STAGE, init);

  //entry point
  var aText: mx.controls.TextArea = new mx.controls.TextArea();
  aText.x = 50;
  aText.y = 350;
  aText.width = 400;
  aText.height = 250;
  aText.wordWrap = true;
  aText.visible = true;
  aText.htmlText = '<b>Lorem ipsum TEST</b>'
  addChild( aText );
}


Interestingly enough, if I replace mx.controls.TextArea with flash.text.TextField, it actually works OK and shows the text.
Do I miss something ? I run the test page from my local IIS. Could the issue be due to "mx.swc" library not visible-to/loadable-by the browser ?
Just in case I placed mx.swc in the same bin folder where my project's swc exists but it did not help.

Any help/suggestion /clue would be greatly appreciated.

Thank you


Thu Jun 18, 2015 12:21 am
Profile
Moderator

Joined: Mon Jul 06, 2009 8:14 am
Posts: 258
Reply with quote
mx.controls.* and spark.components.* classes are used for Flex development. If you don't know it, Flex is a framework on top of Flash aimed at developing applications/user UIs. Since it's a framework on its own it's meant to be used together with the rest of it (of course there are some ways around it, but not always and could lead to some problems), controls have to be added to a Flex container through a function called addElement instead of addChild.


Thu Jun 18, 2015 7:17 am
Profile
Member

Joined: Thu Jun 18, 2015 12:01 am
Posts: 6
Reply with quote
Thank you very much for clarification - it is very helpful.
When I modify the code to use addElement, I am getting compiler error "Call to a possibly undefined method".
Any clue here ?


Thu Jun 18, 2015 1:18 pm
Profile
Moderator

Joined: Mon Jul 06, 2009 8:14 am
Posts: 258
Reply with quote
From what you say you are working on a pure AS Project, so unless you create a Flex Project maybe it's better if you leave that for now. Why do you want to use a mx TextArea? you can use a flash.display.TextField as you discovered, in fact, a mx TextArea uses a TextField behind the curtains.


Thu Jun 18, 2015 1:48 pm
Profile
Member

Joined: Thu Jun 18, 2015 12:01 am
Posts: 6
Reply with quote
OK, I will explain my case - I hope you will find patience to read :)

Software system I maintain has a website which has Flash module written in ActionScript and built with Flex3 compiler. That has been working very well for years, with all Flash releases from 11 until 18 with one very recent issue. After upgrading Flash to version 18, the text that is rendered through mx.TextArea controls does not show up in Chrome browser. There was no single change to the code, in fact the code has not changed for past 3 years. This problem came week ago when Adobe released Flash 18. It only happens when running under Chrome with Flash18.
When I use another machine with Chrome/Flash17, all works OK. So, Chrome and Flash Player 17 work perfect and the text shows up.
The problem doe snot exist under IE and FireFox with FlashPlayer 18. At this point it looks like it is either Chrome or Flash Player issue.

I am not Flash or ActiveScript developer. I actually know nothing about them. I have posted this case to Adobe Flash and ActiveScript forums but nobody answered anything. It seems like my problem must sound silly or stupid to Flash professionals. Given the situation, my only hope is to try figuring things out myself. After some poking around the code I found that only mx.TextArea components do not show up.
In order to understand better what is going on, I decided to create a simple ActiveScript project which uses mx.TextArea and run it in all browsers. This would allow me to decide, if the problem is in FlashPlayer/Chrome or it is in the pieces of before mentioned AS software. I have no Adobe development environment but I stepped on FlashDevelop and it seemed to be the fastest/easiest way for rme.

You know the rest. I wanted a working ActiveScrip app that renders mx.TextArea so I can run it in all browsers. I ended up with hard-stop: I can compile my project but mx.TextArea does not show up in any browser (at least it is consistent :) If you analyze a dead-simple code I wrote, there is no evidence or reason for TextArea not showing up. If I replace TextArea with flash.text.TextField, I am getting the text rendered. There must be a way of rendering mx.TextArea via Active Script.

Perhaps now, when you know more, you can give me some directions or help getting that littley mx.TextArea working ... anyway, whatever comes next, I really appreciate you replied to my post. Thanks a lot !


Thu Jun 18, 2015 7:51 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Flex components (mx.*) have to be added in a Flex container in a Flex application context - otherwise they won't render.
It's all or nothing.

So if you want to go the Flex route you should look into creating a Flex project which will start with a MXML as document class.

There should be a lot of learning material to use Flex, and this is going to be easier for you than figuring everything using the Flash display list.


Mon Jun 22, 2015 9:49 pm
Profile WWW
Member

Joined: Thu Jun 18, 2015 12:01 am
Posts: 6
Reply with quote
Philippe,
thank you for your explanation. Here is the code that I am successfully compiling in FlashDevelop and running in pretty much any browser/FlashPlayer:

Code:
package
{
   import flash.display.Sprite;
   import flash.events.Event;
   import mx.controls.Alert;
   import flash.display.Bitmap;
   import flash.text.TextField;
   import mx.controls.TextArea;

   public class Main extends Sprite
   {
      public function Main()
      {
         if (stage) init();
         else addEventListener(Event.ADDED_TO_STAGE, init);
      }
      
      private function init(e:Event = null):void
      {
         removeEventListener(Event.ADDED_TO_STAGE, init);   
               
         var aTf:TextField = new TextField();
         aTf.x = 150;
         aTf.y = 0;
         aTf.width = 400;
         aTf.height = 250;
         aTf.htmlText = 'TEST 1 TEST 1'
         addChild(aTf);
            
         var aTb: TextArea = new TextArea();
         aTb.x = 150;
         aTb.y = 350;         
         aTb.width = 400;
         aTb.height = 250;   
         aTb.setStyle("backgroundColor", 0xFF0000);
         aTb.visible = true;
         aTb.htmlText = 'TEST 3 TEST 3';
         addChild( aTb );
      }
   }
}


The element created as TextField shows properly while the element created as TextArea cannot be found on the page.
So, the major question here is why I cannot get TextArea visible ? Since the compiler doe snot complain, I'd expect it be rendered as TextField. Could you please explain that or point what is wrong/missing in my code ?

Thank you


Tue Jun 23, 2015 12:52 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Did you even read my answer?

TextArea is a Flex component and it will render only in a Flex container in a Flex application.

Text is a basic Flash display object, like Bitmap, while the Flex framework and components are based on Flash display objects but they have their own lifecycle.

In short: want to use TextArea? Learn Flex.


Tue Jun 23, 2015 7:47 am
Profile WWW
Member

Joined: Thu Jun 18, 2015 12:01 am
Posts: 6
Reply with quote
Philippe, I certainly read your answer. I admit I do not know flex but that cannot be the reason for pretending that something does not add up here. If mx is part of flex, and, as per your note, my application it is not legitimate flex application, why the compiler does not produce any error ? Whenever compiler is involved, and there is something wrong with the code, you have 2 possible outcomes:
1)compiler detects an error
2)compiler compiles but run-time execution detects problem
In this case either (1) or (2) should let me know that i am trying to use "missing" or "forbidden" or "incorrect" library/framework etc. All compiled languages I learned in my life follow this pattern. How come none of the above happens when I build or/and run ActionScript project ? It woul dbe nice to get an explanation, so at least I understand why one can happily do stupid things and never understand they are actually stupid and/or forbidden.

And second, actually far more important question: would you be able to kindly provide (or point to) a "hello world" FlashDevelop project for Flex where I can test mx.TextArea ? My goal is to see how mx.TextArea behaves in different browsers that use FlashPlayer 18. This should be dead-simple for someone who knows Flex. This is really for a quick test, so I can understand if the big problem I try to chase is inside FlashPlayer/Chrome or inside the application that suddenly changed the behavior after working several years. I would absolutely appreciate any help here as I am struggling with this with no chances to reach some conclusion so far.

Thank you very much


Thu Jun 25, 2015 2:47 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
What about 3) there is nothing wrong with the code (in terms of compilation or runtime), the component is simply sitting idle until something (the Flex application) comes and controls it.

As I said, create a Flex 3 project in FlashDevelop - did you do that?
Look at the mx TextArea documentation, it has a Flex 4 sample, it's close to Flex 3. It's XML based, do you have MXML files in the project you maintain?

To go back to your initial Chrome issue this may be something to report to Adobe bugbase. Ideally you should provide a link to examine the problem.

Sadly, this forum isn't a Flash development forum and few of us have used Flex.


Fri Jun 26, 2015 9:04 pm
Profile WWW
Member

Joined: Thu Jun 18, 2015 12:01 am
Posts: 6
Reply with quote
Thank you again - you have provided more few excellent pieces of information in your last post. Please let me comment one-by-one:

(1)mx/flex/AC oddity: I understand you explanation. It looks like Adobe/Flash developers did not make the best and most logical decision. Normally, an erroneous code causes an error that is published to the world through GUI or/and a log. Instead of doing that they decided to bypass the error silently. As creators of the system they obviously have rights to make such decision but it is not the most intuitive and helpful neither it it follows commonly observed standards of software engineering.

(2)flex project: I have not created one yet but I am going to follow your suggestion and try use mx.TextArea documentation and use the sample attached to it. I hope I will be able to build the app with FlashDevelop and, hopefully, learn something interesting.

(3)I'd like to report the original issue as an issue (potential bug) to somebody who is knowledgeable and qualified to deal with it but I just cannot find right place. I have posted exact description of the problem to Adobe ActiveScript and FlashPlayer groups but got no response. I wonder if you would be able to point better place ?

(4)At the end of your post, you said something that puzzled me: " this forum isn't a Flash development forum and few of us have used Flex" - Given the functionality available in FlashDevelop, I honestly thought this is the best forum ever to to ask my questions.

I am very grateful for all your help. If the above (I mean, point #4) is true, then I am even more thankful because you certainly try your best to give me the right direction and some insights and so far you are the only person who approach the whole things with a serious intention to help. If you would know anything to comment my point #3, that would be great but I am not expecting you to babysit me and my problem. I understand that we are all busy with our stuff and you have already done more than I would ever expect.

Thank you


Mon Jun 29, 2015 12:38 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
3. it sounds like a bug but you'll only get people to check it if you can point to a webpage with the bug to see (and ideally with the code).

4. It's a lot of work to support FD, the IDE, without having to deal with teaching people how to develop in Flash.


Mon Jun 29, 2015 5:34 pm
Profile WWW
Member

Joined: Mon Jul 06, 2015 8:10 am
Posts: 1
Reply with quote
Hi,

i have exactly the same problem with a Flex 3 application running since 4 years properly.
Since 3 weeks, TextArea content are not displayed anymore on Chrome with Flash 18 .

JEan


Mon Jul 06, 2015 8:13 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
That may be worth reporting an issue to the chromium project.


Mon Jul 06, 2015 2:19 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.