Using iframe in an actionscript project

76 views
Skip to first unread message

Shilpi

unread,
Nov 23, 2009, 6:03:15 AM11/23/09
to Flex-IFrame
I have used the swc file of the iframe component and tried
initializing it in actionscript using
var _frame:IFrame = new IFrame();
When I try to add this on stage using this.addChild(_frame), it gives
an error.

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at com.google.code.flexiframe::IFrame/handleAdd()[/home/nicoulaj/
workspaces/flexiframe/flexiframe/src/com/google/code/f
lexiframe/IFrame.as:380]
at flash.display::DisplayObjectContainer/addChild()
at iframeTest/loadHTML()[E:\imeet2.0\content5\applications\iframe\src
\iframeTest.as:44]
at iframeTest()[E:\imeet2.0\content5\applications\iframe\src
\iframeTest.as:31]


Please suggest.

Thanks
Shilpi

Julien Nicoulaud

unread,
Nov 23, 2009, 6:56:43 AM11/23/09
to flex-...@googlegroups.com
var _frame:IFrame = new IFrame("someUniqueId");

2009/11/23 Shilpi <bharara...@gmail.com>

Shilpi

unread,
Nov 24, 2009, 12:21:35 AM11/24/09
to Flex-IFrame
thanks for your reply.

I had used your mentioned syntax also still on calling panel.addChild
(_frame) or this.addChild(_frame) the following error appears:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at com.google.code.flexiframe::IFrame/handleAdd()[/home/nicoulaj/
workspaces/flexiframe/flexiframe/src/com/google/code/f
lexiframe/IFrame.as:380]
at flash.display::DisplayObjectContainer/addChild()
at iframeTest/loadHTML()[E:\imeet2.0\content5\applications\iframe\src
\iframeTest.as:50]
at iframeTest()[E:\imeet2.0\content5\applications\iframe\src
\iframeTest.as:30]

I have included flex-iframe.swc version 1.4.2 .Do I need to include
anything else?

I am also attaching my code:

package {

import com.google.code.flexiframe.IFrame;
import flash.display.Sprite;
import flash.text.TextField;

import mx.containers.Panel;

public class iframeTest extends Sprite
{
private var _frame:IFrame;
private var _panel:Panel;
private var _txt:TextField;

public function iframeTest():void
{
loadPanel();
_frame = new IFrame("234");
loadHTML();
}
public var panel:Sprite= new Sprite();
public function loadPanel():void{

panel.graphics.beginFill(0xCCCCCC);
panel.graphics.drawRect(10, 10, 500, 100);
panel.graphics.endFill();


}
public function loadHTML():void{
//_frame.id="one";
_frame.percentHeight = 100;
_frame.percentWidth = 100;
_frame.source = "http://www.google.com";
_frame.overlayDetection = true;
panel.addChild(_frame);
this.addChild(panel);
}
}
}


Thanks in advance
Shilpi Bharara

On Nov 23, 4:56 pm, Julien Nicoulaud <julien.nicoul...@gmail.com>
wrote:
>  var _frame:IFrame = new IFrame("someUniqueId");
>
> 2009/11/23 Shilpi <bharara.shi...@gmail.com>
>
>
>
> > var _frame:IFrame = new IFrame();- Hide quoted text -
>
> - Show quoted text -

Julien Nicoulaud

unread,
Nov 24, 2009, 3:04:39 AM11/24/09
to flex-...@googlegroups.com
Try swaping those lines ?
           panel.addChild(_frame);
           this.addChild(panel);

shilpi bharara

unread,
Nov 24, 2009, 3:11:38 AM11/24/09
to flex-...@googlegroups.com
No use :(
 
Now it gives me the same error on panel.addchild(_frame).
Whereever I am trying to attach(add) the iframe, it produces an error.


shilpi bharara

unread,
Nov 24, 2009, 3:13:58 AM11/24/09
to flex-...@googlegroups.com
I hope I need to only add the swc component. Am I missing something to make the actionscript version working?
 
Thanks
Shilpi

Julien Nicoulaud

unread,
Nov 24, 2009, 7:11:15 AM11/24/09
to flex-...@googlegroups.com
No, you are not missing anything.

See the code for yourself...
http://code.google.com/p/flex-iframe/source/browse/tags/1.4.2/flexiframe/src/com/google/code/flexiframe/IFrame.as#380

The systemManager variable is null, I think this is because you extend Sprite, why do you do this ? Try with DisplayObject or UIComponent.

2009/11/24 shilpi bharara <bharara...@gmail.com>

shilpi bharara

unread,
Nov 27, 2009, 3:10:05 AM11/27/09
to flex-...@googlegroups.com
Hi Julien
 
Thanka for your great support. I tried extending the DisplayObject and UIComponent Class but still it is not working. Do you have any working example where your component works in a Flex builder actionscript project?
I tried creating a Flex project (mxml) and added an iframe through actuonscript, and this worked. :)
But adding iframe by actionscript(using the same code) is not working in an as3 project.
 
I am in a really urgent need, If you have a thread please pass it or if you have any sample of an actionscript project, please let me know.
 
Thanks a lot
Shilpi

Shilpi

unread,
Dec 11, 2009, 6:31:07 AM12/11/09
to Flex-IFrame
Hi Julien

Referring to the following mail, I have tried extending UIcomponent.
But the iframe i still not showing.

Can you please suggest.

Thanks
Shilpi Bharara

On Nov 27, 1:10 pm, shilpi bharara <bharara.shi...@gmail.com> wrote:
> Hi Julien
>
> Thanka for your great support. I tried extending the DisplayObject and
> UIComponent Class but still it is not working. Do you have any working
> example where your component works in a Flex builder actionscript project?
> I tried creating a Flex project (mxml) and added an iframe through
> actuonscript, and this worked. :)
> But adding iframe by actionscript(using the same code) is not working in an
> as3 project.
>
> I am in a really urgent need, If you have a thread please pass it or if you
> have any sample of an actionscript project, please let me know.
>
> Thanks a lot
> Shilpi
>
> On Tue, Nov 24, 2009 at 5:41 PM, Julien Nicoulaud <
>
> julien.nicoul...@gmail.com> wrote:
> > No, you are not missing anything.
>
> > See the code for yourself...
>
> >http://code.google.com/p/flex-iframe/source/browse/tags/1.4.2/flexifr...
>
> > The systemManager variable is null, I think this is because you extend
> > Sprite, why do you do this ? Try with DisplayObject or UIComponent.
>
> > 2009/11/24 shilpi bharara <bharara.shi...@gmail.com>
>
> >  I hope I need to only add the swc component. Am I missing something to
> >> make the actionscript version working?
>
> >> Thanks
> >> Shilpi
>
> >>   On Tue, Nov 24, 2009 at 1:41 PM, shilpi bharara <
> >> bharara.shi...@gmail.com> wrote:
>
> >>> No use :(
>
> >>> Now it gives me the same error on panel.addchild(_frame).
> >>> Whereever I am trying to attach(add) the iframe, it produces an error.
>
> >>>   On Tue, Nov 24, 2009 at 1:34 PM, Julien Nicoulaud <
Reply all
Reply to author
Forward
0 new messages