Reflection Class question

Hello,
I have an xml gallery and I am trying to add reflections to the images. Is there a way I can add the reflections to a loader? Or what do I have to do?
If I can't and I have to make a mc to do this I am not sure what to do. Can someone please help me?
Here is my current code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import com.pixelfumes.reflect.*;
var xmlRequest:URLRequest = new URLRequest("imageData.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML;
var imageLoader:Loader;
var rawImage:String;
var rawH:String;
var rawW:String;
var inTween:Tween
var outTween:Tween
var imgNum:Number = 0;
var checkSec:Timer = new Timer(100);
var numberOfChildren:Number;
var imageReflect:Reflect
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);
btnNext.addEventListener(MouseEvent.CLICK, nextImgF);
btnBack.addEventListener(MouseEvent.CLICK, prevImgF);
btnNext.buttonMode = true;
btnBack.buttonMode = true;
function xmlLoadedF (event:Event):void{
     checkSec.start();
     checkSec.addEventListener(TimerEvent.TIMER, checkerF);
     imgData = new XML(event.target.data);
function packagedF():void{
     checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
     rawImage = imgData.image[imgNum].imgURL;
     numberOfChildren = imgData.*.length();
     rawW = imgData.image[imgNum].imgW;
     rawH = imgData.image[imgNum].imgH;
     imageLoader = new Loader;
     imageLoader.load(new URLRequest(rawImage));
     master_mc.addChild(imageLoader);
     imageLoader.x = (stage.stageWidth - Number(rawW)) /1.65;
     imageLoader.y = (stage.stageHeight - Number(rawH)) /5;
     inTween = new Tween(imageLoader, "x", Regular.easeInOut, 1500, (stage.stageWidth - Number(rawW)) /1.65, 1.5, true);
     imageLoader.scaleX = .8;
     imageLoader.scaleY = .8;
// this next line is the one that I am having a pickle over - where it says "??". I know its supposed to be mc but I am trying to not use mc.
imageReflect = new Reflect({??:imageLoader, alpha:50, ratio:50, distance:0, updateTime:0, reflectionDropoff:1});
function checkerF(event:TimerEvent):void {
if (imgNum == 0) {
packagedF();
}else if(imgNum < numberOfChildren) {
packagedF();
}else{
imgNum = 0;
packagedF();
function nextImgF(e:MouseEvent):void {
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
outTween = new Tween(imageLoader, "x", Regular.easeInOut, (stage.stageWidth - Number(rawW)) /1.65, -1200, 1.5, true);
imgNum++;
function prevImgF(e:MouseEvent):void {
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
outTween = new Tween(imageLoader, "x", Regular.easeInOut, -1200, (stage.stageWidth - Number(rawW)) /1.65, 1.5, true);
imgNum--;
Also the nextImageF works just fine but the prevImageF load both the previous image and the next - AT THE SAAAME TIME! What's up with that? - Do you know?
Thanks for any help!

Well, you could add a MovieClip that would host your Loader instance, and once loading is complete you could apply the refection to the host MovieClip.
Something like this:
var imageLoaderHost:MovieClip;
function packagedF():void{
checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
rawImage = imgData.image[imgNum].imgURL;
numberOfChildren = imgData.*.length();
rawW = imgData.image[imgNum].imgW;
rawH = imgData.image[imgNum].imgH;
imageLoaderHost = new MovieClip();
imageLoader = new Loader;
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
imageLoaderHost.addChild(imageLoader);
master_mc.addChild(imageLoaderHost);
imageLoader.load(new URLRequest(rawImage));
imageLoaderHost.x = (stage.stageWidth - Number(rawW)) /1.65;
imageLoaderHost.y = (stage.stageHeight - Number(rawH)) /5;
inTween = new Tween(imageLoaderHost, "x", Regular.easeInOut, 1500, (stage.stageWidth - Number(rawW)) /1.65, 1.5, true);
imageLoader.scaleX = .8;
imageLoader.scaleY = .8;
function loadCompleteHandler(event:Event)
  imageLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadCompleteHandler);
  imageReflect = new Reflect({mc:imageLoaderHost, alpha:50, ratio:50, distance:0, updateTime:0, reflectionDropoff:1});

Similar Messages

  • Reflection class isn't reflecting

    i've added this reflection class
    http://www.adobe.com/devnet/flash/articles/reflect_class_as3.html
    to this simple .fla file, but i can't see any reflection
    http://www.5y1.com/px02.zip
    thank You for your help

    quote:
    Originally posted by:
    NedWebs
    You're not likely to get people to research your links and
    files for you. If you can describe what steps/code you implemented
    you'll stand a better chance of getting some help.
    The file i've created is so simple that reading how i've
    added the reflect class is just a waste of time

  • Can anyone help me change fonts and size on my page? I don't understand the class questions?

    Can anyone help me change fonts and size on my page? I don't understand the class questions? All I want to do is change the font and size of a table or div.
    http://www.allgearinc.com/AG12SSWL-Swift.htm -One problem page

    If you want to change the fonts of the entire page then this code will do the trick:
    body {
        font-size: 16pt;
        color: silver;
         font-family: whatever, goes, here;
    If you want to change the fonts of ALL tables on a page then the code is something like this:
    table {
        font-size: 20pt;
        font-family: "Courier New", Courier, monospace;
        font-style: italic;
        font-weight: bold;
    what exactly do you want to change?  Can you be a bit specific so that Ben or Ken can give you the exact code and tell you about the short-hand method to write the code in one line.
    Have you bought a book on CSS yet?  If not, it is a good idea to get one as a reference.  Eric Meyer writes good books on CSS.

  • Reflection - class.getConstructor question

    package my.util;
    class Test {
    String s;
    int i;
    public Test(String s, int i){}
    I want to do the following
    Class c = Class.forName("my.util.Test");
    Constructor con = c.getConstructor(new Class[] { String.class, int.class});
    Test t = con.newInstance(new Object[] {"al",5});
    The above obviously won;t compile because I can;t pass primitives to the object array at the time of creating the instance and I cannot do int.class when getting the
    constructor. How do I then use reflection to achieve the
    above..?

    The above obviously won;t compile because I can;t
    pass primitives to the object array at the time of
    creating the instance and I cannot do int.class when
    getting the constructor.you can use int.class. this allows you to distinguish between constructors which accept primitive int versus those which might accept the java.lang.Integer type. but to populate the object array of actual arguments to the reflective invocation, you should wrap primitives in their corresponding wrapper type, e.g. int --> java.lang.Integer, char --> java.lang.Character, and so forth.
    good luck,
    p

  • Java reflection (interesting question)

    hi folks,
    class A {
    void foo() {
    Class B overrides method foo() in A
    class B extends A {
    void foo() {
    Now i create a object of class B and assign to A
    A aref = new B();
    aref.foo() will call method foo()of class B. //polymorphism
    Using reflection, is it possible to call method foo() of class A using the handle aref.
    thanks
    venkat

    hi bondvenky,
    What abt the answer for my original question. How to
    access the base class methods using the handle for
    child class object using reflection ?as far as i know, this isn't possible - your next question is probably going to be "why". It certainly seems slightly surprising that you can't do this, but you can access private methods. Unless you consider the latter a weaker way of breaking encapsulation (!?).
    what was the sun's purpose behind allowing access to
    the private methods of an object using Java
    Reflection? good question.. its very useful but on the other hand i can't think of a time i've used it that couldn't be classed as a hack.
    Is it not a security threat to java security model?it doesn't break anything - ie its not a security loophole. It links in with your question above though - would it have been possible/useful to not allow it period?
    sorry for the vague answers :(
    asjf

  • Inner Class Question

    My question pertains to the code at the bottom of this post.
    I don't understand why the compiler doesn't give an error for the line below. Why would it let you refer to something inside the class (in this case I'm referring to ClassWithInnerClass.MyInnerClass) unless it were static?
    ClassWithInnerClass.MyInnerClass mic = cwic.retMyInnerClass();To illustrate why I'm asking, I created 2 ints ("regularInt" and "staticInt") inside class "ClassWithInnerClass". The compiler let me set the value of "staticInt" from within main whereas it wouldn't let me do so w/ "regularInt" (which is why I commented that line out). Don't get me wrong though - I understand the reasons why the compiler behaves as it does for "regularInt" and "staticInt". I understand that a static variable can be accessed without instantiating a class (and that there's only 1 created no matter how many classes are instantiated). I also understand that, to access a non-static variable, you need to instantiate a class. My question arises only because of trying to extend that logic to MyInnerClass.
    I can already take a guess that the answer is going to be something like, "the reason it works this way is because class 'MyInnerClass' is just a declaration NOT a definiton". I guess I just want confirmation of this and, if possible, some reasoning behind this logic.
    HERE'S THE CODE...
    class CreateInnerClasses {
         public static void main (String args[]) {
              ClassWithInnerClass cwic = new ClassWithInnerClass();
              ClassWithInnerClass.MyInnerClass mic = cwic.retMyInnerClass();
              //ClassWithInnerClass.regularInt = 5;
              ClassWithInnerClass.staticInt = 10;
              mic.printIt();
    class ClassWithInnerClass {
         public int regularInt ;
         static public int staticInt;
         class MyInnerClass {
              void printIt() {
                   System.out.println("Inside ClassWithInnerClass.myInnerClass");
         MyInnerClass retMyInnerClass () {
              return new MyInnerClass();

    The line    ClassWithInnerClass.MyInnerClass mic = cwic.retMyInnerClass();is accepted because the name of the inner class is ClassWithInnerClass.MyInnerClass. This has nothing to do with accessing fields even though the syntax is similar.
    On the other hand, the line    SomeClassWithAnInnerClass.InnerClass ic = new SomeClassWithAnInnerClass.InnerClass();is not accepted because the nested class SomeClassWithAnInnerClass.InnerClass is not static: you must have an instance of the outer class available. The correct syntax for calling the constructor of the inner class would be    Outer.Inner instance = outerInstance.new Inner();In this case you could write:    ClassWithInnerClass.MyInnerClass mic =  new SomeClassWithAnInnerClass() . new InnerClass();
        // OR:
        ClassWithInnerClass.MyInnerClass mic =  cwic . new InnerClass();The Java tutorial has a pretty good explanation on nested classes:
    http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html
    http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html

  • Some newbie POWL feeder class questions

    Hi,
    I'm just working with POWLs resp. the associated feeder class. At the moment I have two question that hopefully could be answered by someone:
    1) Is it possible to modify the UI layout of the selection criteria in a way that they will be displayed in a configurable number of columns and not just one below the other?
    2) I declared some criteria with "ls_seldef-kind = c_type_param.". The user should be able to work with wildcards for these criteria (option "CP"), but the criteria values given to the GET_OBJECTS method always do have the "EQ" option. This is not really useful for e.g. description fields. How can I change this?
    Many thanks in advance for any help.

    I also hope I can know how to do .
    Pleae tell me if you have solved the problem .
    Best regards ,

  • Reflection Classes with the same name

    Hi!
    I have a big problem with reflection. I want to reflect lots of stuff (methods, variables...) in a lot of classes with the same name immediately one after the other. It's like
    copy the file for the analysis to the right place
    do reflection and get results
    copy next file for analysis
    Important to note is, that all of the files that should be reflected have the same name.
    When I run the programm, he always only reflects the first file I gave for analysis, although I know the copying-stuff works and the new file would be there for analysis (but he does not seem to load/use it).
    Any ideas what i could do?
    Thanks!
    ET

    I'm not sure if i'm authorised to tell too much
    details, but i have to do some automated software
    analysis and therefore I need to know whats inside of
    a class and string search would not be appropriate.Why not ? What aspects of the class are you trying to examine ?
    They have the same name, because they are delivered in
    that form from a third party and it would be too much
    effort (and to much risk of errors) to rename them.Sure, if they're delivered as class files, you're unable to rename them. Without knowing more I can't advise you further.
    Why are you interested that much in that topic? Do you
    have to perform a similar task?No, I'm trying to determine if reflection is the right tool for the job. Frankly it doesn't sound like it is. But since you're not authorised to tell me more, I can't help you more.
    Dave.

  • Importing Java Class Question

    Hello,
    Sorry for such a newbie question and such a long post, I did remember how to do this before but now I can't for the life of me remember. Anyhow, I have a simple question about importing custom-made java classes, from another directory in the windows operating system. I have the classpath set, and also I realize that because the two files below are in the same directory theres no need for an import statement as Java will look for the class in the same directory.
    But I would like to know how the import statement is suppose to look to import a custom made java class from another directory, (assuming of course that I set the correct classpath)
    here's the java class location:
    c:\school\csc365\narcus.java
    //narcus.java
    import java.io.*;
    class narcus implements Comparable
    String firstName = "firstName";
    String lastName = "lastName";
         public narcus()
         firstName = firstName;
         lastName = lastName;
         public narcus(String f)
         firstName = f;
         lastName = lastName;
         public narcus(String f, String l)
         firstName = f;
         lastName = l;
    public String getFirst()
    return "first..";
         public int compareTo(Object e)
         return 1;
    Here's the location of the driver program thats suppose to use the narcus.java class
    c:\school\csc365\test.java
    //test.java
    //import statement? maybe import "c:\\school\\csc365\\*"; ?
    import java.io.*;
    class test
    public static void main(String[] args)
         narcus jim = new narcus();
         System.out.println("omg\n");
         System.out.println(jim.getFirst());
    And also, here is my classpath:
    PATH=c:\school\csc365\;c:\school\
    The classpath also points to the jdk libraries and few other directories but I didn't write that above, as it probably isn't relevant.
    I've tried the following import statements.
    import "c:\\school\csc365\\narcus.java";
    import "narcus.java";
    import "c:\\school\\csc365\\*";
    But I keep getting an error that says:
    test.java:1 <identifier> expected
    Any help is appreciated!

    Hi Folks,
    I am new to this forum, heard that interesting discussions always happens on this forum so immediately registered,don't want to miss any oppurtunity to participate in discussions.
    I have pretty much basic question regarding compiling and exceuting files in different packages.I have the following directory structure
    C:\Projects\WDPROEast\Development\CommonService\Code\Java from where java files stored in different packages as follows:
    com\wdpro\commerce\common\crm\dae\nautilus\adapter directory has java files in com.wdpro.commerce.coomon.crm.dae.nautilus.adapter package.
    com\wdpro\commerce\common\dae\exception has java files with package named com.wdpro.commerce.common.dae.exception.
    com\wdpro\commerce\common\dls\exception has java files with corresponding package name.
    com\wdpro\commerce\common\dto has java files under proper package name.
    com\wdpro\commerce\common\exception has java files with appropriate package name.
    com\wdpro\commerce\common\util has java files with package name. I am starting at Java Directory,want to compile and run file named a.java in com.wdpro.commerce.coomon.crm.dae.nautilus.adapter package with having all other java files on classpath as follows
    so I issued command for compilation as follows C:\Projects\WDPROEast\Development\CommonService\Code\Java>javac com/wdpro/commerce/common/crm/dae/nautilus/ada
    pter/a.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/NautilusServiceUtility.java com/wdp
    ro/commerce/common/crm/dae/nautilus/adapter/URLReader.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/
    b.java com/wdpro/commerce/common/dae/exception/*.java com/wdpro/commerce/common/dto/*.java
    com/wdpro/commerce/common/exception/*.java com/wdpro/commerce/common/util/*.java com/wdpro/commerce/common/dl
    s/exception/*.java It compiled greatly but when I issue command to run a.class file as
    C:\Projects\WDPROEast\Development\CommonService\Code\Java>java com/wdpro/commerce/common/crm/dae/nautilus/adap
    ter/UtilityAccesssit's giving following exception
    Exception in thread "main" java.lang.NoClassDefFoundError: com/wdpro/commerce/common/crm/dae/nautilus/adapter/
    UtilityAccesssbut when I run a.java with the following command
    C:\Projects\WDPROEast\Development\CommonService\Code\Java>java com/wdpro/commerce/common/crm/dae/nautilus/adap
    ter/UtilityAccess com/wdpro/commerce/common/crm/dae/nautilus/adapter/NautilusServiceUtility.java com/wdpro/com
    merce/common/crm/dae/nautilus/adapter/URLReader.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/Nautil
    usAccessUtility.java com/wdpro/commerce/common/dae/exception/*.java com/wdpro/commerce/common/dto/*.java com/w
    dpro/commerce/common/exception/*.java com/wdpro/commerce/common/util/*.java com/wdpro/commerce/common/dls/exce
    ption/*.javaSo my question do I need to add all required java files to path when required class files are under different packages?is it manadatory.
    I hope you understand my question,pass me any comments you may have.
    Thanks alot,
    Anu

  • The arrays class question

    consider the code below
    int[] list = {2, 4, 7, 10};
    java.util.Arrays.fill(list, 7);
    java.util.Arrarys.fill(list, 1, 3, 8);
    System.out.print(java,util.Arrays.equals(list, list));i understand line 2, it gonna fill 7 into the array,so the output would be Line 2: list is {7, 7, 7, 7}
    my question is line 3, how come the output would be {7, 8, 8,7} what does 1 and 3 represent in a arrary?
    the line 4 output would be {7, 8,8,7} again why?
    Thank you guys whoever is gonna take to respond me questions

    zerogpm wrote:
    but which 2 lists were comparing ? since i have list list with the same name1) You're not comparing lists, you're comparing arrays.
    2) You're comparing a single array with itself.
    3) Objects, including arrays, do not have names. Classes, variables, and methods have names. Objects do not.

  • Where is the getString() implementation for RS and Object class question

    Dear all,
    I had these two questions ringing since a long time.
    1)ResultSet is an interface.
    In my jdbc code I have generally written rs.getString() and rs.getInt etc.. without giving a second thought as to where exactly is this getter implemented !
    I have RTF API .. without too much help.
    Could some one kindly explain Where is the implementation of the getString method ?
    2) Could you please tell why the Wait() Notify() and NotifyAll methods have been implemented in the Object class ? What was the need to define em in the Object class ?
    Thanks in advance for your time spent on this.
    Rgds

    Sarvananda wrote:
    In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
    >
    why do you need that?
    ..Thats a design decision
    One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
    Rgds
    >
    In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
    >
    why do you need that?
    ..Thats a design decision
    One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
    A desire to not have to couple your code to a particular database and JDBC driver. It's a classic example of the abstract factory pattern

  • Inner classes question

    Hi guys,
    I have a question to ask - when i'm writing an inner class and i want to create a new instance from it, the Eclipse forces me to use an instance of the containing class to call new.
    Is it how it's done or am i doing something wrong?
    public class A
        // Some code here
        public class B
             //Some code here
    }Trying to create an instance:
    A a = new A();
    A.B b = a.new B();

    What you have defined is "non-static" inner class.A "non-static" can only be instantiated only if we create an object of outer class.True.
    >
    There are two ways to create "inner" class object,
    1)The way you have written the codeTrue.
    2)
        public class A
    {    // Some code here    
    public void createInner()
    classB b=new ClassB();
    public classB   
    //Some code here   
    That code won't compile. Even if you corrected it so that it did compile, it doesn't really help in the OP's situation. Did you read the advice of Saish and Jos about why class 'B' probably shouldn't be public, anyway?

  • Parent Class question

    I have a panel class with a slider on it .
    pseudocode:
    public class MyJSlider extends JPanel{
    private JSlider myjslider;
    private Color mycolor;
    public Color getColor(){return mycolor;}
    the action taken by the JSlider is to set mycolor to a new Color(r,g,b);
    My question, is there away to call the class that istantiated teh MyJSlider objects paint method from the
    JSlider action performed
    Something like
    slider_B.addChangeListener(
                   new ChangeListener()
                        public void stateChanged(ChangeEvent e)
         mycolor = new Color(R,G,slider_B.getValue());
    // super.paint() ????????

    If it's an inner class like that, it has access to the outer class's fields and final instance variables.
    You can access those methods implicitly.
    But you typically don't call paint() directly, you call repaint(), which issues a call to the GUI to repaint itself. (Although maybe it's different in Swing, I don't know.)
    When you post code please wrap it in &#91;code] &#91;/code] tags so it's easy to read.

  • JAXB class question

    does anyone know which jar file has the javax.xml.XMLConstants class? I'm getting an error while going through some examples for JAXB and I am almost positive that my classpath is messed up or not pointing to the right jars.

    Good job mate. That's the way!
    And you came back and let us know we needn't waste precious time answering a solved question. That's just exellent. Thanks.
    :)

  • Tutorial Q&E : Implementing Nested Classes, Question 2

    //1.3
    Taken from http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/nested-answers.html
    import java.util.*;
    public class Problem {
    public static void main(String[] args) {
    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
    public void run() {
    System.out.println("Exiting.");
    timer.cancel();
    5000);
    System.out.println("In 5 seconds this application will exit. ");
    Question 2: The program Problem.java (above) doesn't compile. What do you need to do to make it compile? Why?
    Answer 2: Add final in front of the declaration of the timer variable. A nested class declared within a method has access to any final, local variables in scope.
    Could somebody please elaborate on this answer for me? I don't really feel it gives enough information for me to understand fully the "why?" part.
    Thanks
    Mark

    Hi,
    the problem is that the instace of the nested class is still existing after the execution of the method has been finished. But how should it have access to a variable which doesn't exists anymore?
    The only way to solve this problem is to declare the variable as final. Because then the value of the variable is known when the instance of the nested class is created an can be copied. Then at each place in the nested class where the variable is used, the copy is used instead. This is only valid because the value of the variable cannot be changed after the creation of the nested class' instance.
    Andre

Maybe you are looking for

  • Can't seem to clear Flash cache in Firefox 4 on Windows 7 (64-bit)

    When updating my work's webpage, I cannot seem to get a certain flash component to update. It works fine in IE so I know that it's not on the server's side. I have tried clearing all cache and even private browsing. Nothing I do will cause Firefox to

  • Different Compressor settings for export in FCPX = same result

    HI For test purposes for a movie screener to upload, I've been changing the settings of a custom Compressor setting I imported into FCPX but seem to get the same result size-wise whether its 1- or 2-pass. Do I need to delete the icon in FCPX and then

  • Basic questions about warranty and AppleCare.

    First, although folks in another forum have said otherwise, staff at the New York Apple Store, and a customer sales person on the phone, said that installing 3rd party RAM myself voided the warranty. Is this true? Second--via a link from one of the p

  • Updating XML Code reflected in iTunes?

    Okay so I originally submitted a podcast with a working XML feed, and it was accepted. However, since then I have changed the feed, to have different titles. The link to the actual mp3 is the same. I just changed the title of the group or the main ti

  • Download Applications on iPod Touch

    Can user download applications on the iPod Touch? Or I can use only apps that I have on my Touch?