Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1101543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:03:04+00:00 2026-05-17T01:03:04+00:00

I’m using AMFPHP 1.9, ActionScript 3 and Adobe Flash Pro CS5 with Flash player

  • 0

I’m using AMFPHP 1.9, ActionScript 3 and Adobe Flash Pro CS5 with Flash player 10x. I was trying to get data by calling amfphp serices. I’m running the app from within the Flash IDE.

For primitive types like string or integer it’s working fine. But when trying to get a custom object it shows the following error:

SecurityError: Error #2000: No active security context.

And the parameter in the result handler function contains null. Did I miss anything here? Please help.

Following are my classes:

ServiceContext.as

import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import flash.events.NetStatusEvent;

internal class ServiceContext
{
    protected var myService:NetConnection;

    public function ServiceContext():void
    {
        myService = new NetConnection();
        myService.objectEncoding = ObjectEncoding.AMF3;
        myService.connect("http://localhost/MyApp/amfphp/gateway.php");
        myService.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
    }

    private function onNetStatus(event:NetStatusEvent):void
    {
        trace(event.info);            
    }
}

SceneService.as

import com.ddr.cv.model.Scene;
import flash.net.Responder;    

public class SceneService extends ServiceContext
{
    public function SceneService():void
    {
        com.ddr.cv.model.Scene.register();
    }

    public function getSceneByID(sceneID:uint, resultHandler:Function, faultHandler:Function)
    {
        var responder = new Responder(resultHandler, faultHandler);
        myService.call("com.ddr.cv.model.Scene.getSceneByID", responder, sceneID);
    }

    public function saveScene(scene:Scene, resultHandler:Function, faultHandler:Function)
    {
        var responder = new Responder(resultHandler, faultHandler);
        myService.call("Scene.saveScene", responder, scene);
    }
}

Scene.as

    import flash.display.MovieClip;
    import flash.net.registerClassAlias;

    [RemoteClass(alias="com.ddr.cv.model.Scene")]
    [Bindable]
    public class Scene extends MovieClip
    {

        private var _id:uint;
        public function get id():uint
        {
            return _id;
        }

        private var _sceneName:String;
        public function get sceneName():String
        {
            return _sceneName;
        }

        private var _imageName:String;
        public function get imageName():String
        {
            return _imageName;
        }

        private var _sceneCategoryID:int;
        public function get sceneCategoryID():int
        {
            return _sceneCategoryID;
        }

        private var _userID:String;
        public function get userID():String
        {
            return _userID;
        }

        private var _creationDate:Date;
        public function get creationDate():Date
        {
            return _creationDate;
        }

        public function Scene(id:uint = 0, sceneName:String = null, imageName:String = null, sceneCategoryID:int = 0, userID:String = null, creationDate:Date = null):void
        {
            _id = id;
            _sceneName = sceneName;
            _imageName = imageName;
            _sceneCategoryID = sceneCategoryID;
            _userID = userID;
            _creationDate = creationDate;
        }

        public static function register():void
        {
            registerClassAlias("com.ddr.cv.model.Scene", com.ddr.cv.model.Scene) ;
        }
}

and here’s Scene.php

    <?php
class Scene {

    var $id;
    var $sceneName;
    var $imageName;
    var $sceneCategoryID;
    var $userID;
    var $creationDate;

    // explicit actionscript package
    var $_explicitType = "com.ddr.cv.model.Scene";

    function Scene($id = 0, $sceneName = null, $imageName = null, $sceneCategoryID = 0, $userID = null, $creationDate = null)
    {
        $this->id = $id;
        $this->sceneName = $sceneName;
        $this->imageName = $imageName;
        $this->sceneCategoryID = $sceneCategoryID;
        $this->userID = $userID;
        $this->creationDate = $creationDate;
    }

    function getSceneByID($id){
        //creating dummy Scene object
        $scene = new Scene(1, "Test Scene", "test_scene.jpg", 6, null, null);
        return $scene;
    }

    function saveScene($scene)
    {
        //To Do:
    }
}
?>

Here’s how I call the service:

var sceneService:SceneService = new SceneService();
sceneService.getSceneByID(1, getSceneByID_resultHandler, getSceneByID_faultHandler);

Handlers:

    public function getSceneByID_resultHandler(scene:com.ddr.cv.model.Scene):void
    {
        //scene contains null here.
        //Shouldn't it contain the dummy Scene object from amfphp service method?
        trace("Success: " + scene);
    }

    public function getSceneByID_faultHandler(fault:Object):void
    {
        trace(">>> fault:" + fault.description);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:03:04+00:00Added an answer on May 17, 2026 at 1:03 am

    @daidai: Thanks very much that you replied. I thought this post would reside forever deep inside the SOF database unanswered/ non-replied and never see light. And then, after 10 long days, you replied 🙂 I upped your answer because you cared to reply. Thanks once again.

    I tested it from browser too. Same result.

    But I finally figured out why it was not working several days back. The problem is, for some strange (or security) reason, custom AS3 classes that inherit from MovieClip (and I guess for all system classes) cannot be mapped from their PHP counterparts, in my case, from the Scene.php class.
    But the AS3 class can be sent to the PHP service class and be successfully mapped.
    I had to bring in some changes to my architecture to address this issue and solved my problem. But this problem really put me on edge and I kept this post under hourly watch for days in hope of some reply.

    Anyway, I only tested it on Flash player version 10.1.82.76. I don’t know if it works in the previous versions as I did not test on them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.