voxxsound
10-23-2007, 05:47 PM
The site I am working on has one main .swf and 4 other .swf subpages that I am loading into it. In the first subpage, I have a text box that I am loading dynamically, and I have also added a UIScrollBar component (all using AS). See below code:
var loadText:URLLoader = new URLLoader();
var loadReq:URLRequest = new URLRequest("assets/h_news3.txt");
var news_txt:TextField = new TextField();
var textScrollBar:UIScrollBar = new UIScrollBar();
var tf:TextFormat = new TextFormat();
tf.color = 0x666666;
tf.font="Franklin Gothic Book";
tf.size = 12;
tf.align = "justify";
tf.leftMargin = 7;
tf.rightMargin = 7;
news_txt.defaultTextFormat = tf;
news_txt.x = 313;
news_txt.y = 215;
news_txt.width = 425;
news_txt.height = 190;
news_txt.wordWrap = true;
news_txt.multiline = true;
addChild(news_txt);
textScrollBar.move(news_txt.x + news_txt.width, news_txt.y);
textScrollBar.height = news_txt.height;
textScrollBar.scrollTarget = news_txt;
loadText.addEventListener(Event.COMPLETE, textComplete);
loadText.load(loadReq);
function textComplete(event:Event):void
{
news_txt.htmlText = loadText.data;
addChild(textScrollBar);
loadText.removeEventListener(Event.COMPLETE, textComplete);
}
When I export this subpage, the scrollbar appears and works fine. When I load it into the main .swf, the scrollbar does *not* appear (even though you can click and drag where the scrollbar should be and it scrolls the text) and I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::LabelButton/fl.controls:LabelButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
When I remove the code for the UIScrollBar it goes away, but something is happening between the 2 different .swf's and I cant figure out what it is. I have tried adding the TextField to the stage within the textComplete function, same with the UIScrollBar. Any ideas??
*Note: I did post this issue a few weeks ago but didnt get a response. Since it was part of another string and I didnt include the source code I thought I would try again. Any help here would be greatly appreciated. I have *got* to get this project done
var loadText:URLLoader = new URLLoader();
var loadReq:URLRequest = new URLRequest("assets/h_news3.txt");
var news_txt:TextField = new TextField();
var textScrollBar:UIScrollBar = new UIScrollBar();
var tf:TextFormat = new TextFormat();
tf.color = 0x666666;
tf.font="Franklin Gothic Book";
tf.size = 12;
tf.align = "justify";
tf.leftMargin = 7;
tf.rightMargin = 7;
news_txt.defaultTextFormat = tf;
news_txt.x = 313;
news_txt.y = 215;
news_txt.width = 425;
news_txt.height = 190;
news_txt.wordWrap = true;
news_txt.multiline = true;
addChild(news_txt);
textScrollBar.move(news_txt.x + news_txt.width, news_txt.y);
textScrollBar.height = news_txt.height;
textScrollBar.scrollTarget = news_txt;
loadText.addEventListener(Event.COMPLETE, textComplete);
loadText.load(loadReq);
function textComplete(event:Event):void
{
news_txt.htmlText = loadText.data;
addChild(textScrollBar);
loadText.removeEventListener(Event.COMPLETE, textComplete);
}
When I export this subpage, the scrollbar appears and works fine. When I load it into the main .swf, the scrollbar does *not* appear (even though you can click and drag where the scrollbar should be and it scrolls the text) and I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::LabelButton/fl.controls:LabelButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
When I remove the code for the UIScrollBar it goes away, but something is happening between the 2 different .swf's and I cant figure out what it is. I have tried adding the TextField to the stage within the textComplete function, same with the UIScrollBar. Any ideas??
*Note: I did post this issue a few weeks ago but didnt get a response. Since it was part of another string and I didnt include the source code I thought I would try again. Any help here would be greatly appreciated. I have *got* to get this project done