[Red5] [red5] class mapping as3 -> red5
Dominick Accattato
dominick at red5.org
Thu Oct 15 06:50:05 PDT 2009
You need to have a hard reference to your Red5ProfileVO somewhere so that
the compiler includes it in the compilation process. people usually
statically add these custom classes somewhere in their main.mxml file. it
looks something like this:
// located somewhere in a file that is compiled.. typically the main.mxml
file.
private static var staticClasses:Array = [Red5ProfileVO, CustomClass2,
CustomClass3];
After that you should be able to declare your method like so instead of
casting:
public void setMyProfile(Red5ProfileVO profileVO){
let me know if this solves your issue.
On Tue, Oct 13, 2009 at 11:45 PM, terbooter <dmitry.zinovyev at gmail.com>wrote:
>
> I have the same question.
> Im try to send value object from flash to red5
>
> I have Red5ProfileVO class with identical package path.
> In flash side I use RemoteClass metatag (flex compiler)
> //////////////////////////////Red5ProfileVO.as
> package com.terbooter {
>
> /**
> * ...
> * @author terbooter
> */
> [RemoteClass(alias="com.terbooter.Red5ProfileVO")]
> public class Red5ProfileVO {
>
> public var sex:String;
> public var age:String;
> public var id:String;
> public var nickname:String;
> public var city_name:String;
>
> public function Red5ProfileVO() {
>
> }
>
> }
>
> }
> ///////////////////////////
>
> /////////////////////////////In red5 side I have class Red5ProfileVO.java
> package com.terbooter;
>
> //import java.io.Serializable;
>
> import org.red5.server.api.IConnection;
>
> public class Red5ProfileVO {
> //private static final long serialVersionUID = 108374100L;
> public String sex;
> public String age;
> public String id;
> public String nickname;
> public String city_name;
> //public IConnection connection;
> }
>
> After that I invoke callback from flash with object of type Red5ProfileVO
> as
> parameter
>
> public void setMyProfile(Object obj){
> Red5ProfileVO red5ProfileVO = new Red5ProfileVO();
> // Red5ProfileVO red5ProfileVO = (Red5ProfileVO) obj; <---If Im tring
> to cast recieved object I recieve error.
> log.error("---------------"+obj.toString());
> //In log file i see: ---------------{id=1, city_name='s-Gravenzande,
> sex=male, nickname=Dmitry, age=27}
> }
>
>
> Could somebody show small working sample?
>
>
> Nick de Groot wrote:
> >
> > Hi,
> >
> > I'm trying to map my custom classes between as3 and red5. In as3 i'm
> > doing a registerClassAlias call to register the class. My code looks
> > like
> >
> > registerClassAlias("com.company.objects.Test", Test);
> >
> > In my red5 application I have a package called com.company.objects
> > with Test class inside.
> >
> > In my flash app I'm opening a netconnection and try to send a Test
> > class as parameter. On my red5 server the error appears that
> > com.company.objects.Test cannot be found.
> >
> > I'm very confused because the package and class exists as defined but
> > red5 cannot find it.
> >
> > Can someone explain what I'm doing wrong?
> >
> >
> > _______________________________________________
> > Red5 mailing list
> > Red5 at osflash.org
> > http://osflash.org/mailman/listinfo/red5_osflash.org
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-red5--class-mapping-as3--%3E-red5-tp25881312p25884925.html
> Sent from the Red5 - English mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20091015/8fce9bef/attachment.html>
More information about the Red5
mailing list