forum > target Javascript with resources

  • I want to embed images (base64) in my javascipt code. (haxe targeting javascript). But when I do that using Resource.getString("base64image") de 'image-string' isn't 'injected' at compile time but at runtime. It works but as a mentioned at runtime and not at compile time. Also, I can get all of the Meta data to work (javascript). Meta.getType(Main) works, but Meta.getFields(Foo) doens't.

    Am I doing something wrong?

  • What I mean is that i can'T get all of the MetaData to work

  • I just looked into the generated javsscript code and noticed that the base64image is there unlike I mentioned in my previous post. I'm sorry!

    But the MetaData, Meta.getFields(Foo), problem still holds.

  • Hello!


    Without any example code to look at, I'm assuming you are embedding the image via the resource command?


    Cheers
    Skial

  • My question is why, not being a js guru, more just a dabbler I don't know the reasoning behind your request?
    In my divtastic I either use an image defined on the css for the page or load one dynamically and although I really need some loading code for dynamically when images are larger or force it to load when hidden, mostly it works fine eg:

        public function setImage( img: String )
        {
            
            _img = img;
            
            if( img.split('.').length > 1 )
            {
                
                //trace('setting image to ' + img );
                _style.backgroundImage = 'url(' + img +')';
                
            }
            else
            {
                
                _dom.className = img ;
                
            }
    
    }

    I can explain a standalone version if it's helpful but should be able to guess, from this code.
< Prev | Page 1 / 1 | Next >